pyiron / pyiron_workflow

Graph-and-node based workflows
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Stringy graph representation #503

Open liamhuber opened 1 day ago

liamhuber commented 1 day ago

We have Composite.graph_as_dict, but there is an appetite for something even stringier. I currently imagine output like:

{
    "some_parent": "mypackage.macros.ThisAwesomeMacro",
    "children": {
        "c1": "pyiron_workflow.nodes.standard.UserInput",
        "c2": {
            #... blah blah, the point is it's a macro so we nest the representation
        },
        "c3": "anotherpackage.DoIt",
    }
    "data_edges": (
        ("c1.user_input", "c2.foobar"),
        ("c2.out1", "c3.i_need_this"),
        ("c2.out2", "c3.also_this"),
    )
    "execution_edges": (
        ("c1.ran", "c2.run"),
        ("c2.ran", "c3.run"),
    )
}

I don't see any obstacle to doing this, graph_as_dict is already extremely similar, but it muddies things by actually including instances in the dictionary. This just strings it all down.