Closed jconti closed 13 years ago
This is possible... See Sample11.rb (https://github.com/glejeune/Ruby-Graphviz/blob/master/examples/sample11.rb)
Thanks! This looks easily good enough. Guess using the prefix 'cluster' is no more magic that Graphviz itself. Thanks for the code, I like writing these drawings in Ruby.
I am working on generating Statecharts using ruby. One of the important features of these graphs is that sets of nodes can be connected to other sets of nodes with edges. The sets of nodes are themselves drawn in a box (called a superstate sometimes).
Graphviz can be coaxed to accomplish this. This stack overflow article shows the solution: http://stackoverflow.com/questions/2012036/graphviz-how-to-connect-subgraphs
My request is that if the ruby-graphviz user creates subgraphs that are clusters, and connects them together with an edge, the little hack above in the stackoverflow article is used to draw directly from one cluster to another. The ltail and lhead attributes would be generated automatically by ruby-graphviz.
initial = g.subgraph("cluster initial startup") show_toggle_prompt = initial.add_node( "show_toggle_prompt" ) blink_info = initial.add_node( "blink_info" ) initial.add_edge(show_toggle_prompt, blink_info)
select_prompts = g.subgraph("cluster selector prompts")
g.add_edge(initial, select_prompts) # this creates an edge between the two subgraphs
What do you think?
Best, John