diprism / fggs

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

Add an option to generate tikz file from FGG JSON. #180

Closed chihyang closed 2 months ago

chihyang commented 3 months ago

This PR adds an option to FGG --tikz <file>. Given an output file path, it will generate a complete TeX file. When this TeX file is compiled, a multiple-page PDF will be generated. Every page of this PDF corresponds to a rule in the given FGG. This might be better than a single dot file because when a FGG contains hundreds of rules, it might be hard to read a single image generated from a dot file.

chihyang commented 3 months ago

This layout is copied from the dot: it first generates a dot graph and then copies the automatic position info when generating tikz. But somehow most nodes from the dot are on the same line, so I made small changes to move them a bit to avoid overlap. But they are still quite close. Moving nodes with a larger offset would make this look better. But a perfect layout would require more arrangements. Maybe manual adjustment (without using dot?) is better?

ccshan commented 3 months ago

@davidweichiang We're going to merge this, because it's an improvement. But has the graph layout always been this bad?

davidweichiang commented 3 months ago

I wonder why I didn’t get a notification for this originally. It’s been a long time since I looked at this, but because the layout is based on graphviz, it shouldn’t be that bad — so maybe something happened to make it worse?

On Tue, Jun 11, 2024 at 16:56 Chung-chieh Shan @.***> wrote:

@davidweichiang https://github.com/davidweichiang We're going to merge this, because it's an improvement. But has the graph layout always been this bad?

— Reply to this email directly, view it on GitHub https://github.com/diprism/fggs/pull/180#issuecomment-2161588821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKVY2LBY64LCUIW7RDNDZ3ZG5QBFAVCNFSM6AAAAABJC3XFIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGU4DQOBSGE . You are receiving this because you were mentioned.Message ID: @.***>