diprism / fggs

Factor Graph Grammars in Python
MIT License
13 stars 3 forks source link

Shortcuts for FGG creation #108

Closed davidweichiang closed 2 years ago

davidweichiang commented 2 years ago

When writing #99 I found myself frequently writing things like

g.add_edge(el, [node1, node2])

instead of

g.add_edge(Edge(el, [node1, node2]))

I wonder if it would make sense to provide some convenience functions to make FGG creation code more concise, or even to cut out some layers of data structure.

IMO the simplest way to create a graph would be

g = Graph()
node1 = g.add_node("foo")
node2 = g.add_node("bar")
g.add_edge("baz", [node1, node2])