mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
36.83k stars 2.39k forks source link

Allow using different graphviz engines #193

Open meshuga opened 4 years ago

meshuga commented 4 years ago

The tool currently uses dot engine to visualise the diagrams. That tool is good for hierarchical, small graphs. With bigger diagrams, the engine starts showing its suboptimality.

In https://github.com/Cloud-Architects/aws-network-discovery, we discovered sfdp engine to work well with bigger diagrams but right now the engine is passed to diagrams in a hacky way - https://github.com/Cloud-Architects/aws-network-discovery/blob/2b6c555886cdcd4517b6da13bc41b8d0fdb1ab7a/shared/diagram.py#L171.

It would be good for the tool to provide a configuration, to be able to select graphviz engine.

clayms commented 3 years ago

@meshuga - totally agree.

You can use different Graphviz engines. Just set the graph_attr "layout" parameter to "neato" or "fdp".

See these answers: https://github.com/mingrammer/diagrams/issues/17#issuecomment-722045799 https://github.com/mingrammer/diagrams/issues/243#issuecomment-721971788 https://github.com/mingrammer/diagrams/issues/279#issuecomment-722004811

meshuga commented 3 years ago

@clayms Thanks for the response. For the tool I develop I found sfdp most useful as it can render complex network diagrams, other engines have troubles in doing so and the way it is done uses non-documented and potentially breaking internal features - https://github.com/Cloud-Architects/cloudiscovery/blob/v2.2.4/cloudiscovery/shared/diagram.py#L297

The thing that bothers me is fact that there's no support of the regular clusters, something e.g. diagrams.net has. Becasue of that, I started work to move parts of the diagrams (AWS VPC diagram generation away from this library, in favour of diagrams.net) - https://github.com/Cloud-Architects/cloudiscovery/pull/158#issue-517339689

Generated sample below gives a proof it's not something impossible: image

FYI @leandrodamascena