Skip to content

Support for cyclical graphs #455

Open

Description

@pgleeson

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

Activity

  1. pgleeson commented on Apr 26, 2023

    @pgleeson
    MemberAuthor

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

  2. Devadeut commented on Mar 23, 2024

    @Devadeut

    @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?

  3. pgleeson commented on Mar 25, 2024

    @pgleeson
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions