Due to organizational changes, the Graphviz web site will see some modifications in the near future. In particular, it will probably no longer provide binary packages for Windows and Macs. The latter can be obtained via Macports or Home Brew. If someone wants to set up Appveyor for Windows, we would be grateful. |

# layout different after saving through -dot using fdp

Submitted by ds on Fri, 06/03/2016 - 14:55

New question from a newbie to the forum.

I am using:

fdp -T svg -o out.svg in.dot

If instead I write to an intermediate dot file e.g.:

fdp -T dot -o mid.dot in.dot

followed by:

fdp -s -T svg -o out.svg mid.dot

I get very different graphs. Can someone please explain why this is so, or what I can do to change this behavior so the two give the same result? I'm trying to update the graph and this is killing me.

Thanks.

## Recent comments

- update

8 weeks 4 days ago - re: yum install - Error downloading packages

16 weeks 5 days ago - yum install - Error downloading packages

17 weeks 1 day ago - Hi,
Sorry, I was a little

18 weeks 1 day ago - The difficulties you are

22 weeks 3 days ago - Is there a question?

26 weeks 5 hours ago - same problem: png not recognized

26 weeks 17 hours ago - Thank you

26 weeks 3 days ago - The obvious answer is that

26 weeks 3 days ago - There is no real time help.

26 weeks 3 days ago

## When you fdp -T svg -o

When you fdp -T svg -o out.svg in.dot, fdp draws the graph using random positions for the nodes and then applies the force-directed algorithm

When you do the second approach: fdp min.dot | fdp -s -Tsvg -o out.svg, fdp uses the positions from the first run as the starting point for the second run, and then applies the force-directed algorithm. So, of course, the layouts will be different. Indeed, even without position info, fdp chooses a random initial layout, so two runs

fdp in.dot

fpd in.dot

will potentially produce different layouts.

If you don't want to change the layout, but just render the graph, use neato -n or neato -n2. These assume the input graph has its node (and edge) coordinates specified, and just renders the output.