diprism / fggs

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

More convenience functions #129

Closed davidweichiang closed 2 years ago

davidweichiang commented 2 years ago

In #126 we added some convenience functions to simplify FGG creation, but it wasn't enough; this PR adds more functions and demonstrates them on parser.py.

davidweichiang commented 2 years ago

Somehow a commit is missing and I'm not sure if it's because of the Github downtime or my mistake...

darcey commented 2 years ago

(Is this ready to review? Did the previous commit reappear?)

davidweichiang commented 2 years ago

Yes, it reappeared!

One thing about this is that it works best if you create the whole HRG first and then its interpretation. If you try to create them at the same time, the convenience functions may not work. In particular, if you try to add a domain or factor before adding a rule that contains the corresponding node or edge label, then there will be an exception.