Mindmap layout

I would like to reproduce a mindmap using graphviz. The layout will have to look like the image below: There are several properties in the mindmap above I am not able to reproduce: - A node represented by a underlined text can be reproduced by using a postscript function, but when I try to connect an edge to the underline of the node using the "sw" or "se" ports, the tail or the head of the edge does not point in direction of the port, but toward the center of the node creating a strange U shape close to the port. (e.g. from the above graph: Brain:se -> Ideas:sw, there will be a strange U shape close the the port sw of Ideas if I use graphviz to produce the layout) How can I avoid to have a U shape around the ports ? - How can I produce a tree layout like the branches in the above mindmap? The closest result I got was when using dot, but the nodes are positioned more in a table fashion following rank orders instead of a tree layout. - Sometimes, I have create graphs that may contain external nodes along with a mindmap. The external node can be connected to the nodes in the mindmap. If I want to create a layout in 2 steps, e.g.: dot mindmap.dot > mindmap-half_done.dot # Trying to create a tree layout using dot. Now all nodes have a position. $ vim mindmap-half_done.dot # To manually add an external node. Now NOT all nodes have a position. $ neato -n2 mindmap-half_done.dot # Trying to position the external nodes without disturbing the already positioned nodes in the mindmap. # There will be an error because not all node have a position. how can a produce a layout from a dot file in which not all nodes have a position?

port-u-shape.dot_.txt348 bytes
port-u-shape.png17.13 KB

  If you are using ports,


  • If you are using ports, the edge should point to the port. If there is a U, this is probably a bug. Can you post an example or submit a bug report? Thanks. By the way, you might also consider using <U>text</U>.
  • None of the Graphviz layouts will provide a good mindmap drawing, as the drawing principles are all very different. The closest you could come would be to split your tree in two, duplicating the root. Then draw one using rankdir=LR, the other with rankdir=RL, and then combine the drawings by identifying the roots. This will be close, but you will still see ranks, because that is what dot does. One could conceivably do a post-processing step in which you compress the layout horizontally to get closer. That said, why not use one of the many mindmap software packages and get what you want directly?
  • neato -n2 requires all nodes have a position, so in step 2, you would either need to give a new node a position, or add it to the graph and re-run the mindmap layout.

1) I edited the first post to

1) I edited the first post to include examples of U shapes in edges close to nodes. The edge is attached to the port, that is true, but the edge at the port is pointed according toward the center of the node, creating a U shape in the edge spline.

2) I wish to use graphviz to create the mindmaps because there are several advantage:

- Dot language can be easily processed by basic plain text parser. 

- Dot language is popular and many applications has developed ressources to work with it.

- It is a visually intuitive text-based description of graphs, so I can easily read and modify a graph in a text editor.

I use it a bit like a glue language for communicating knowledge between the brain (that can easily assimilate information from relevant descriptive images) and the computer (that can easily process information written in a simple plain text language)

3) Is there a way to set automatically the position of the remaining node that does not have a position yet? This can be a very useful feature when a graph have to be processed more than once.

That is actually a feature as

  1. That is actually a feature as it provides a cleaner approach to the port. I admit that it might be something you don't want. I will see if this can be loosened.
  2. I agree with all of your points wholeheartedly. That doesn't take away from the fact that none of the layouts in graphviz does exactly what you want. My suggestion of two runs of dot followed by compaction is the best I can come up with. And looking at your example, I have to admit I still don't see what rules are being used. For example, why is Consciousness not further to the right? Could you post the abstract graph related to your example?
  3. Sure, if you can describe where a new node should be placed.

2) The mindmap above is an

2) The mindmap above is an image I took from an other site. I don't have an abstract graph of it, but it shows most of the features I'm interested in a mindmap. It wouldn't bother me if Conciousness was more to the right. I can follow your suggestion, and do a run of dot for each side of the mindmap and combine them at the end, but I will still have to solve problem 3) to have an entirely automatic layout creation.

3) If there are some external nodes outside of the mindmap connected to some part of the mindmap, I will still have to "describe where a new node should be placed" by manually writing pos="xx,xx" at a certain step during the creation of a layout which makes the procedure not entirely automatic.

The only solution I have found to solve this problem for the moment, is to replace the subgraph that contains the already positioned nodes, with a big node of equal size. Then I make a run of dot to have the big "subgraph replacing node" with the remaining external nodes positioned. Then I replace the big "subgraph replacing node" with the subgraph made earlier. This way, although it allows an entire automatic layout creation, has several drawbacks:
- Dot, not knowing what is inside the big subgraph replacing node, will probably position the external nodes not in an optimal way according to what it is connect to inside the replaced subgraph
- The external node will automatically be positioned outside of the subgraph which can make the graph becomes bigger that it has to be.

3. What wasn't clear to me

3. What wasn't clear to me initially was if there were any constraints on the new nodes. From your recent comments, it would appear the new node is inserted into the tree and you would like to extend the previous layout. You could try the approach you describe, but it has the drawbacks you mention. Rather, I would just insert the node in its correct (graph) position in the tree (that is, add it to the input graph in a conservative fashion) and re-run dot. In general, the new dot layout could be very different, but if you keep the input file basically the same, you should end up with basically the same tree, just with the new node added.

Dot is not designed for incremental updates, so you still may get a surprise. However, given the simplicity of your desired layout, it would not be difficult to write a stable mindmap layout algorithm for incremental updates. Even here, though, one could imagine adding sufficient new nodes that the layout at some point should be globally and optimally laid out again.

Recent comments