Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for cyclical graphs #455

Open
pgleeson opened this issue Apr 26, 2023 · 3 comments
Open

Support for cyclical graphs #455

pgleeson opened this issue Apr 26, 2023 · 3 comments

Comments

@pgleeson
Copy link
Member

If A->B and B->A, one of these needs to be the start point when evaluating the graph. But what does the input port of the start node get when it has an edge from the output port of the not yet run node?

One option is to define a "default_value" on one of the input ports and the graph can be "snipped" there...

Work on this in progress here: https://github.com/ModECI/MDF/tree/cyclic_graphs

@pgleeson
Copy link
Member Author

Potential extension for cyclical graphs: add parameter cycle_default_value - the default value only to use when it's in a cycle, not standalone.

@Devadeut
Copy link

Devadeut commented Mar 23, 2024

@pgleeson in addition to this:
snippet from src/modeci_mdf/execution_engine.py


def init(self, node: Node, verbose: Optional[bool] = False):
self.verbose = verbose
self.node = node
self.evaluable_inputs = {}
self.evaluable_parameters = OrderedDict()
self.evaluable_functions = OrderedDict()
self.evaluable_outputs = {}


Can using OrderedDict() be the reason for the existing constraint?

@pgleeson
Copy link
Member Author

Not really. It's basically that one of the nodes in a cycle (e.g. A->B->C->A) needs to be flagged as "this is the one to start evaluating the nodes at". We will do this by stating that an input node has a default value, and that this can be used to start the evaluation, e.g. if A has a default value, you don't have the problem that you first need to evaluate the output of C, but before that the output of B, but before that A...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants