Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111766

Re: Algorithm for sequencing a collection of dependent equations

From Tim Golden <mail@timgolden.me.uk>
Newsgroups comp.lang.python
Subject Re: Algorithm for sequencing a collection of dependent equations
Date 2016-07-22 17:35 +0100
Message-ID <mailman.59.1469205349.22221.python-list@python.org> (permalink)
References <1469203273.1522601.673919081.7AC3AFEA@webmail.messagingengine.com> <38f58976-713b-a59f-a030-ddf3d21a8439@timgolden.me.uk>

Show all headers | View raw


On 22/07/2016 17:01, Malcolm Greene wrote:
> We're working on a DSL (domain specific language) that we translate into
> a list of tokenized expressions. My challenge is to figure out how to
> sequence evaluation of these expressions so that we evaluate these
> expressions in the proper order given that expressions have dependencies
> on other expressions.
>
> We've done the work to determine the full list of tokens associated with
> each expression (after referencing other expressions) and we've detected
> expressions that result in loops.

[... snip ...]

> I'm looking for an algorithm/data structure that will me to start with
> the least dependent expression (t, x, y) and move through the list of
> expressions in dependency order ending with the expression with the most
> dependencies.
>
> I imagine that spreadsheets have to perform a similar type of analysis
> to figure out how to recalculate their cells.
>
> Suggestions on algorithms and/or data structures (some form of graph?)
> to support the above goals?

I think that what you're looking for is a topological sort

TJG

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Algorithm for sequencing a collection of dependent equations Tim Golden <mail@timgolden.me.uk> - 2016-07-22 17:35 +0100

csiph-web