Graphing social connections

Hello everyone, I've been using graphviz for a little while now and I've always been really amazed by the quality of the outputs. I've always succeed in tweaking a bit my graphs so that the final output was the one I wanted, until now. I'd like to build a tool to graph my connections to my groups of friends. Basically, I have a few groups of friends (<10) that I want to represent as node around a root node (that would be me) Some of my friends can be part of 1, 2 or maybe 3 different groups max. I'm not considering subgroups yet. My idea is that such a graph should look like this: with "friends" organizing in a circular way around the "group" nodes (squares in the pict above). And if a person belongs to two groups, then the way it should be represented is by making it part of the two "circles" (like in the bottom left corner). I absoluetely want to keep the circles, because I believe they are conceptually close to the notion of "group of friends", much more than a tree-like structure for exemple. So I've been playing around with twopi and circo, but I can't figure out a way of having it behave how I expect. - Circo works great until the point where a person is connected to more than two nodes. And since circo is designed to work with be connected components, it becomes something like this: - Twopi produces a really neat output, but the nodes dont circle back all the way around the group nodes: Here's the really simple code I've use for the above examples: graph G { node [shape="circle", label=""] mindist=0.2 overlap=scale R--A R--B R--C R--D A--A1 A--A2 A--A3 A--A4 A--A5 A--A6 A--A7 A--A8 A--AB B--B1 B--B2 B--B3 B--B4 B--B5 B--B6 B--B7 B--B8 B--AB C--C1 C--C2 C--C3 C--C4 C--C5 C--C6 C--C7 C--C8 D--D1 D--D2 D--D3 D--D4 D--D5 D--D6 D--D7 D--D8 } So, do you guys know anyway of achieving the behavior I want? Thank you very much ! (will keep you posted if I find a solution myself) Sincerely,

Graphing social connections

Unfortunately, the style of drawing you want is not possible with any single one of the layout tools.
The closest you can come is using neato or sfdp, which produces something like the attached figure.
The nice circular layouts of groups is missing.

Using a scripting language, you can probably get close:

- Determine the layout size of each group, as the radius of a circle containing it. This can be
done by
running twopi on each group or, if the nodes always have uniform size, by a simple computation based on
the number of nodes in each group.

- Create a group graph. Use one node for each group, and one for the root. Make each group a
circle with the
radius calculated in the previous step. Add an edge between the root and each group, and an edge
between any
two groups sharing a node. Run neato or sfdp on this graph with overlap=false or scale.

- Take that layout and replace each circular group node with a star subgraph, using a square node
in the center
to represent the group root, and the other nodes on a circle around it. The only difficulty is in
handling nodes in
two groups. Probably the simplest approach is to place it on the circle of the larger group, but on
the side close
to the other group.

This will all begin to fall apart if the intergroup relations start to get complex but, in that
case, nothing is going to
give you a nice drawing.


Recent comments