problem with makefile visualization with graphviz

Hi ,

 I'm trying to visualize Makefile using dot and my graph is no getting balanced attached gif has the screenshot , as you can see bottom tree is not symmetric more protruding towards left side .

I've checked this but this doesn't solve my problem http://www.graphviz.org/content/FaqBalanceTree Can anyone help me ? Is there any work around for this ? I'm using the below commands and inputs

dot -x -Ttk input.dot -o GUI.tcl input.dot has

 

digraph G { size="10,10"; overlap="false"; 12345671023 -> 12345671047; 12345671043 -> 12345671047; 12345671021 -> 12345671009; 12345671023 -> 12345671044; 12345671013 -> 12345671006; 12345671023 -> 12345671048; 12345671044 -> 12345671048; 12345671028 -> 12345671030; 12345671022 -> 12345671035;

.... ....

12345671059 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671060 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671061 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671062 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671063 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671064 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671065 [shape=box,fontsize=14,fontcolor=black,size="10,10"] 12345671066 [shape=box,fontsize=14,fontcolor=black,size="10,10"] }

AttachmentSize
Graphviz.png23.02 KB
dotTest.txt6.98 KB
reordered_dot.txt2.78 KB

You might see if the

You might see if the unflatten tool can help. Also, can you post your full graph? That way, one can experiment. Thanks.

problem with makefile visualization with graphviz

Thanks .

Here is my full graph !

tried unflatten -f -l 50 input.gv | dot -Ttk -o out.tcl ;

graph didn't change much it is same as previous ( attached in above message )

Sorry, the full graph

Sorry, the full graph apparently didn't make it.

file attached

Plz check now , I've attached file along with GUI screenshot .

If by balanced, you want the

If by balanced, you want the layout to be somewh left-right symmetric, there are various things you can do. The input order of nodes and edges is important. Barring other constraints, the layout will tend to follow the input order. So you can get some balancing by reordering your input. (I'm not sure how you are generating your nodes and edges, but if your graph has a natural flow, it is usually a good idea to generate the graph in something of a breadth-first search.)

This is a heuristic approach. If you want to nail things down further, you can use the rank=same attribute on nodes on a given level, and add left-to-right invisible edges to enforce a left-to-right ordering.

Here is what I get with a quick application of the first approach. Note that, although this layout is more balanced, it seems more cramped. You might want to increase the ranksep and nodesep attributes to get a bit more room.

 

digraph G {
node [shape=box,fontsize=14,fontcolor=black,size="10,10"]

12345671000 -> 12345671013;
12345671001 -> 12345671013;
12345671002 -> 12345671013;
12345671013 -> 12345671006;
12345671006 -> 12345671014;
12345671014 -> 12345671015;
12345671015 -> 12345671016;
12345671016 -> 12345671004;
12345671004 -> 12345671017;
12345671017 -> 12345671018;
12345671003 -> 12345671021;
12345671003 -> 12345671018;
12345671018 -> 12345671012;
12345671018 -> 12345671005;
12345671018 -> 12345671019;
12345671019 -> 12345671020;
12345671019 -> 12345671007;
12345671019 -> 12345671024;
12345671020 -> 12345671008;
12345671020 -> 12345671025;
12345671020 -> 12345671021;
12345671021 -> 12345671009;
12345671021 -> 12345671022;
12345671022 -> 12345671031;
12345671022 -> 12345671033;
12345671022 -> 12345671023;
12345671022 -> 12345671032;
12345671022 -> 12345671010;
12345671022 -> 12345671034;
12345671021 -> 12345671026;
12345671022 -> 12345671035;
12345671022 -> 12345671039;
12345671022 -> 12345671041;
12345671022 -> 12345671042;
12345671022 -> 12345671040;
12345671022 -> 12345671038;
12345671022 -> 12345671037;
12345671022 -> 12345671036;
12345671031 -> 12345671035;
12345671031 -> 12345671041;
12345671031 -> 12345671037;
12345671033 -> 12345671039;
12345671023 -> 12345671045;
12345671023 -> 12345671027;
12345671023 -> 12345671011;
12345671023 -> 12345671028;
12345671023 -> 12345671044;
12345671023 -> 12345671046;
12345671023 -> 12345671047;
12345671023 -> 12345671048;
12345671023 -> 12345671052;
12345671023 -> 12345671053;
12345671023 -> 12345671051;
12345671023 -> 12345671050;
12345671023 -> 12345671054;
12345671023 -> 12345671043;
12345671023 -> 12345671049;
12345671043 -> 12345671047;
12345671028 -> 12345671030;
12345671044 -> 12345671048;
12345671043 -> 12345671053;
12345671045 -> 12345671051;
12345671044 -> 12345671050;
12345671044 -> 12345671054;
12345671028 -> 12345671060;
12345671056 -> 12345671060;
12345671032 -> 12345671042;
12345671028 -> 12345671055;
12345671028 -> 12345671066;
12345671056 -> 12345671066;
12345671028 -> 12345671059;
12345671055 -> 12345671059;
12345671028 -> 12345671062;
12345671056 -> 12345671062;
12345671028 -> 12345671057;
12345671034 -> 12345671040;
12345671028 -> 12345671061;
12345671055 -> 12345671061;
12345671057 -> 12345671063;
12345671032 -> 12345671038;
12345671001 -> 12345671003;
12345671028 -> 12345671056;
12345671028 -> 12345671065;
12345671055 -> 12345671065;
12345671028 -> 12345671064;
12345671058 -> 12345671064;
12345671032 -> 12345671036;
12345671028 -> 12345671029;
12345671046 -> 12345671052;
12345671028 -> 12345671058;
12345671043 -> 12345671049;
}

 

 

reg dot

Hi erg , 

     Yes , I want left & right side of the graph  to be symmetric 

actually from makefile I'm parsing the node information and encripting them , so that all nodes have same text width .

if I directly give the node names from makefile , dot is generating box's of different shapes even after specifying size parameter .

I've reordered the graph by altering my perl algo , still I dont see any major differences( attached it )

 

How did you reorder the graph , I see that your graph has improved interms of symmetricity 

if you have used unflatten command  can you share the switches used

-->might want to increase the ranksep and nodese

do we have any documents/man pages on how to use them ?

 

Thanks :)

The width and height

The width and height parameters for nodes specify the minimum width and height. If you want this fixed, you need to set fixedsize=true.

Unflatten is useful is you want to improve the aspect ratio; it won't help in this case. The problem is that there is nothing in the dot layout algorithm that is designed to make a graph left-right balanced. Your graph is mostly tall and thin, except you have one node near the bottom that has many children. In turn, it has a child which also has many children. As both of these are placed to the left of its parent, the drawing is skewed left. Roughly speaking, nodes are placed in the left-right order in which they appear. I simply re-ordered the graph input so these two nodes appear after several of their sibling nodes, so they are drawn roughly below their parents.

You can read about ranksep and nodesep on the documentation pages:

http://www.graphviz.org/content/attrs#dnodesep

http://www.graphviz.org/content/attrs#dranksep

Recent comments