Hey
I want to plot a graph of 128 nodes (labeled 1 to 128) in graphviz using circular layout. Circo does this, but I want the nodes to be placed in order of their label number instead of the order created by circo (based on the edges between them). Also, there may be nodes with no incoming or outgoing edges, but still have to be placed in the circular order.
I have tried fiddling with edge weight but it didn't affect anything. I could get the no-edge nodes to appear in the circo circle using invisible edges between adjacent nodes (e.g. 1->2, 2->3, …, 128->1). But the order is still left wanting.
Is there any way to achieve this? I would really appreciate any help in this regard. Here is my code:
digraph{
size="8,6"
layout=circo
node [shape=square,fontsize=300,penwidth=2]
1->2 [style=invis]
2->3 [style=invis]
3->4 [style=invis]
4->5 [style=invis]
5->6 [style=invis]
6->7 [style=invis]
7->8 [style=invis]
8->9 [style=invis]
9->10 [style=invis]
10->11 [style=invis]
11->12 [style=invis]
12->13 [style=invis]
13->14 [style=invis]
14->15 [style=invis]
15->16 [style=invis]
16->17 [style=invis]
17->18 [style=invis]
18->19 [style=invis]
19->20 [style=invis]
20->21 [style=invis]
21->22 [style=invis]
22->23 [style=invis]
23->24 [style=invis]
24->25 [style=invis]
25->26 [style=invis]
26->27 [style=invis]
27->28 [style=invis]
28->29 [style=invis]
29->30 [style=invis]
30->31 [style=invis]
31->32 [style=invis]
32->33 [style=invis]
33->34 [style=invis]
34->35 [style=invis]
35->36 [style=invis]
36->37 [style=invis]
37->38 [style=invis]
38->39 [style=invis]
39->40 [style=invis]
40->41 [style=invis]
41->42 [style=invis]
42->43 [style=invis]
43->44 [style=invis]
44->45 [style=invis]
45->46 [style=invis]
46->47 [style=invis]
47->48 [style=invis]
48->49 [style=invis]
49->50 [style=invis]
50->51 [style=invis]
51->52 [style=invis]
52->53 [style=invis]
53->54 [style=invis]
54->55 [style=invis]
55->56 [style=invis]
56->57 [style=invis]
57->58 [style=invis]
58->59 [style=invis]
59->60 [style=invis]
60->61 [style=invis]
61->62 [style=invis]
62->63 [style=invis]
63->64 [style=invis]
64->65 [style=invis]
65->66 [style=invis]
66->67 [style=invis]
67->68 [style=invis]
68->69 [style=invis]
69->70 [style=invis]
70->71 [style=invis]
71->72 [style=invis]
72->73 [style=invis]
73->74 [style=invis]
74->75 [style=invis]
75->76 [style=invis]
76->77 [style=invis]
77->78 [style=invis]
78->79 [style=invis]
79->80 [style=invis]
80->81 [style=invis]
81->82 [style=invis]
82->83 [style=invis]
83->84 [style=invis]
84->85 [style=invis]
85->86 [style=invis]
86->87 [style=invis]
87->88 [style=invis]
88->89 [style=invis]
89->90 [style=invis]
90->91 [style=invis]
91->92 [style=invis]
92->93 [style=invis]
93->94 [style=invis]
94->95 [style=invis]
95->96 [style=invis]
96->97 [style=invis]
97->98 [style=invis]
98->99 [style=invis]
99->100 [style=invis]
100->101 [style=invis]
101->102 [style=invis]
102->103 [style=invis]
103->104 [style=invis]
104->105 [style=invis]
105->106 [style=invis]
106->107 [style=invis]
107->108 [style=invis]
108->109 [style=invis]
109->110 [style=invis]
110->111 [style=invis]
111->112 [style=invis]
112->113 [style=invis]
113->114 [style=invis]
114->115 [style=invis]
115->116 [style=invis]
116->117 [style=invis]
117->118 [style=invis]
118->119 [style=invis]
119->120 [style=invis]
120->121 [style=invis]
121->122 [style=invis]
122->123 [style=invis]
123->124 [style=invis]
124->125 [style=invis]
125->126 [style=invis]
126->127 [style=invis]
127->128 [style=invis]
128->1 [style=invis]
25->42 [penwidth=5]
25->71 [penwidth=7]
26->25 [penwidth=5]
26->40 [penwidth=6]
27->30 [penwidth=6]
29->25 [penwidth=9]
29->26 [penwidth=9]
29->27 [penwidth=6]
29->30 [penwidth=4]
29->32 [penwidth=4]
29->40 [penwidth=5]
29->80 [penwidth=5]
32->39 [penwidth=5]
33->28 [penwidth=5]
33->44 [penwidth=4]
33->74 [penwidth=6]
37->34 [penwidth=6]
37->66 [penwidth=5]
37->69 [penwidth=4]
38->60 [penwidth=4]
38->107 [penwidth=5]
40->100 [penwidth=5]
47->30 [penwidth=4]
48->35 [penwidth=6]
48->36 [penwidth=4]
50->35 [penwidth=5]
50->63 [penwidth=5]
51->50 [penwidth=5]
51->96 [penwidth=4]
52->50 [penwidth=8]
53->51 [penwidth=7]
53->96 [penwidth=4]
59->50 [penwidth=5]
59->51 [penwidth=6]
59->52 [penwidth=5]
59->60 [penwidth=5]
60->50 [penwidth=10]
60->63 [penwidth=4]
60->95 [penwidth=4]
67->74 [penwidth=4]
67->114 [penwidth=4]
68->74 [penwidth=5]
70->74 [penwidth=6]
70->126 [penwidth=4]
71->74 [penwidth=8]
71->86 [penwidth=4]
72->70 [penwidth=4]
75->39 [penwidth=4]
77->81 [penwidth=5]
79->73 [penwidth=6]
80->84 [penwidth=4]
82->78 [penwidth=5]
82->114 [penwidth=4]
86->115 [penwidth=5]
87->115 [penwidth=5]
87->121 [penwidth=5]
91->69 [penwidth=5]
91->87 [penwidth=5]
96->30 [penwidth=5]
96->114 [penwidth=5]
101->107 [penwidth=5]
102->108 [penwidth=5]
107->75 [penwidth=5]
107->78 [penwidth=6]
108->95 [penwidth=5]
108->103 [penwidth=4]
111->80 [penwidth=5]
111->114 [penwidth=5]
114->128 [penwidth=4]
115->114 [penwidth=4]
118->128 [penwidth=5]
119->103 [penwidth=5]
121->72 [penwidth=4]
123->116 [penwidth=5]
125->80 [penwidth=4]
126->122 [penwidth=7]
128->96 [penwidth=5]
}
Best Answer
I think, the only solution is to use a neato' layout and the pos attribut.
To do what you want, I start by creating a small Ruby script to calculate all nodes positions :
Then, I put the result in the graphviz script :