Graphviz Dot - Strange edge routing and node placement -


i'm new graphviz/dot , tried create first dot-diagram. basics went quick fixing layout took me time , think i'm lost enough time , better ask more experienced people...

it's routing of edge tried fix telling locate edge @ nodes describe here: strange edge placement in graphviz dot worked routing same strange thing (should bi right instead of left through content).

the second 1 node placement of 3 bottom nodes left. placed better diagram fit perfect on portrait a4 page...

state diagram

digraph { "passslave1" [label="pass command slave (2nd tier)"] "passslave2" [label="pass command slave (2nd tier)"] "success1" [label="cmd_signal_success", shape=box] "success2" [label="cmd_signal_success", shape=box] "powerup" [label="power / system reset", peripheries=2, color="red", fontcolor="red"] "acknowledge1" [label="cmd_signal_acknowledge", shape=box] "acknowledge2" [label="cmd_signal_acknowledge", shape=box]  subgraph bl {     "powerup" -> "wait \"enter bootloader\" request"      "wait \"enter bootloader\" request" -> "enter bootloader" [label="\"enter bootloader\" request received"]     "wait \"enter bootloader\" request" -> "start firmware" [label="timeout while awaiting \"enter bootloader\" request"]      "enter bootloader" -> "idle" // [constraint=false]     "idle" -> "idle" [label="no command received"]     "idle" -> "check device id" [label="set_bootload_target (device id) received"] } subgraph {     rankdir=lr      subgraph match {         "check device id" -> "acknowledge1" [label="match"]         "acknowledge1" -> "istarget (flash mode)"         "istarget (flash mode)" -> "acknowledge2" [label="cmd_start_download (byte count) received"]              "acknowledge2" -> "istarget (flash mode)"             "istarget (flash mode)" -> "istarget (flash mode)" [label="no data / commands received"]             "istarget (flash mode)" -> "process data (hex records)" [label="data received"]             "process data (hex records)" -> "istarget (flash mode)" [constraint=false]             "istarget (flash mode)" -> "success1" [label="cmd_end_download received"]             "success1" -> "idle" [constraint=false]              //"process data (hex records)" -> "istarget (flash mode)" [label="no error occured"]             //"process data (hex records)" -> "istarget (flash mode)" [label="error occured"]     }      subgraph mismatch {         "check device id" -> "pass command slaves (2nd tier)" [label="mismatch"]         "pass command slaves (2nd tier)" -> "awaitingslavebootloadtargetacknowledge"         "awaitingslavebootloadtargetacknowledge" -> "awaitingslavebootloadtargetacknowledge" [label="no acknowledge received"]         "awaitingslavebootloadtargetacknowledge" -> "hastarget" [label="acknowledge received"]          "hastarget" -> "hastarget" [label="no command received"]         "hastarget" -> "passslave1" [label="cmd_start_download (byte count) received"]         "passslave1" -> "awaitingslavestartdownloadacknowledge"         "awaitingslavestartdownloadacknowledge" -> "awaitingslavestartdownloadacknowledge" [label="no acknowledge received"]         "awaitingslavestartdownloadacknowledge" -> "hasdownloadtarget" [label="acknowledge received"]          "hasdownloadtarget" -> "hasdownloadtarget" [label="no data / commands received"]         "hasdownloadtarget" -> "pass data (hex records) slave (2nd tier)" [label="data received"]         "pass data (hex records) slave (2nd tier)" -> "hasdownloadtarget"         //"hasdownloadtarget" -> "awaitingslaveenddownloadresponse" [label="cmd_end_download received"]         "hasdownloadtarget" -> "passslave2" [label="cmd_end_download received"]         "passslave2" -> "awaitingslaveenddownloadresponse"         "awaitingslaveenddownloadresponse" -> "awaitingslaveenddownloadresponse" [label="no command received"]         "awaitingslaveenddownloadresponse"  -> "success2"         "success2":e -> "idle":n [constraint=false]     } } 

}

if edge placement problem refers edge "success2":e -> "idle":n going left rather straight up, reason dot wants minimize edge crossings. other path cause @ least 1 crossing, current path picked having 1 crossing. 3 left bottom nodes, dot algorithm wants make edges short possible, while trying respect edge directions, "best" solution place them side side. dot doing supposed given constraints. 1 way fix second problem add minlen=2 edge "istarget (flash mode)" -> "acknowledge2".

however, recommend different course, using fewer constraints. if graph has natural flow, order in nodes , edges should described. should minimize need add constraint=false attributes. example, want success2 , success1 @ bottom, should not mentioned @ top of graph. if consider "powerup" node root, remaining edges , nodes should occur in dfs order. also, if node appears before node b, , on same rank, node left of node b. reason, list "wait \"enter bootloader\" request" -> "start firmware" before "wait \"enter bootloader\" request" -> "enter bootloader". basically, describe graph in natural top-down order, , avoid adding structural constraints unless necessary want.

another suggestion concerns edge labels. edge labels treated @ dummy nodes. works well, heavyweight approach can distort layout, long labels. consider changing some, or many, of longer edge labels xlabels. in way, placed after basic layout done.

note rankdir attribute has no effect within subgraph. affects root graph.

anyway, here how restructure graph file giving result result http://www.graphviz.org/misc/forum/place.png.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -