Each time I convert graph object to dot language using approach shown below - the order of siblings is lost. Is there any way to avoid this?
StringWriter theGraph = new StringWriter();
graph.printGraph(theGraph);
theGraph.toString();
Update:
My program generates graphs and displays them in java applet. In order to have them formatted I use GrappaSupport.filterGraph function to feed non formatted graph to dot.exe and get back formatted graph. The function returns a graph object. However to send graph to applet I need to display it as string so I convert it back to dot language (using code given above).
Graph generated by my program:
digraph "Graph" {
i168CF2[label="PROPERTY\n(2-cur.)" ]
i168D02[style=filled, label="NAME\n(2-9, 13-cur.)", color=palegreen ]
i168CF2->i168D02
i168D010[style=filled, label="NAME\n(10-12)", color=lightgrey ]
i168CF2->i168D010 [color=lightgrey]
i168D22[style=filled, label="TEXT\n(2-9)", color=lightgrey ]
i168CF2->i168D22 [color=lightgrey]
i168D210[style=filled, label="TEXT\n(10, 12-cur.)", color=palegreen ]
i168CF2->i168D210
i168D211[style=filled, label="TEXT\n(11)", color=lightgrey ]
i168CF2->i168D211 [color=lightgrey]
}
Layouted by dot.exe and converted back to dot language graph:
digraph "Graph" {
graph [bb = "0,0,552,144"];
i168D22 [
height = "0.74639",
style = filled,
color = lightgray,
width = "1.0344",
label = "TEXT\n(2-9)",
pos = "37,27"
];
i168CF2 [
height = "0.74639",
width = "1.7589",
label = "PROPERTY\n(2-cur.)",
pos = "250,117"
];
i168D211 [
height = "0.74639",
style = filled,
color = lightgray,
width = "1.0344",
label = "TEXT\n(11)",
pos = "130,27"
];
i168D02 [
height = "0.74639",
style = filled,
color = palegreen,
width = "1.7826",
label = "NAME\n(2-9, 13-cur.)",
pos = "250,27"
];
i168D210 [
height = "0.74639",
style = filled,
color = palegreen,
width = "1.6779",
label = "TEXT\n(10, 12-cur.)",
pos = "393,27"
];
i168D010 [
height = "0.74639",
style = filled,
color = lightgray,
width = "1.1153",
label = "NAME\n(10-12)",
pos = "512,27"
];
i168CF2 -> i168D010 [
color = lightgray,
pos = "e,481.77,44.917 304.57,103.17 347.98,92.22409.87,74.943462,54465.47,52.605 469.02,51.046 472.55,49.404"
];
i168CF2 -> i168D210 [
pos = "e,358.38,49.305 284.98,94.473 304.52,82.452 329.02,67.371 349.75,54.614"
];
i168CF2 -> i168D22 [
color = lightgray,
pos = "e,65.486,44.636 200.92,99.814 167.46,88.26 122.43,71.686 84,54 80.855,52.553 77.634,50.978 74.425,49.344"
];
i168CF2 -> i168D211 [
color = lightgray,
pos = "e,155.54,46.726 219.1,93.338 202.15,80.909 181.11,65.483 163.74,52.741"
];
i168CF2 -> i168D02 [
pos = "e,250,54.046 250,90.073 250,81.999 250,72.943 250,64.296"
];
}
As you can see order of node's i168CF2 children changed from: i168D02, i168D010, i168D22, i168D210, i168D211
To: i168D22, i168D211, i168D02, i168D210, i168D010
Is there any way to avoid this? This shuffle takes place during conversation from graph object to dot language not during automated layout using dot.exe (it returns the same order).