-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
Problem
Graphviz produces very spread out images when laying out medium to large functions. Please see this SVG image.
findParentsWithEdges.zip
Background
There are a few causes for the large layout.
- In the function
doGraphLayoutinapp/Rendering.hs, the Graphviz node is set as a circle with a radius equal to the maximum height or width of the diagram. Since icon rotation happens after layout, using a large circle for the Graphviz node shape ensures that icons can be rotated without overlapping. However, this also means that the Graphviz node is much larger than the actual icon, especially for non-circular icons. - Graphviz does not seem to do a good job at graph layout when the node sizes have a high degree of variation. If Graphviz can not find a layout without overlaps, it reverts to scaling up the size of the layout. This means that all edges become longer.
Possible Solutions
- Graphviz has many layout algorithms, and each algorithm has many parameters. It's possible a better choice of algorithm or parameters in
app/Rendering.hscould improve things. - Something that might help would the following: after getting the graph layout from Graphviz, iteratively rotate the icons and check for overlap. Keep scaling down the layout until there is overlap. This approach might help a bit, but would not fix the deeper problem of a bad layout.
- Create a better graph layout algorithm. Such an algorithm ideally would also incorporate node rotation with layout.
The current plan of action is to investigate solution #3, creating a better graph layout algorithm.