Tags: graphviz

RSS - Atom - Subscribe via email

Digraphs with Graphviz

| geek

And for the geeks, here’s the Graphviz dot file that created the graph in How to do a lot. Posting here because I know I’m going to forget, and also because it’s so cool…

digraph {
  label = "Do things that complement each other";
  subgraph {
    rank=same
    experimenting
    programming
  }
  writing
  presenting
  programming -> writing  [label="new experience"]
  experimenting -> writing [label="new experience"]
  programming -> experimenting [label="automation"]
  experimenting -> programming [label="improvements"]
  writing -> presenting [label="content,\nopportunity"]
  presenting -> writing [label="content"]
  writing -> programming [label="reflection,\nideas"]
  writing -> experimenting [label="reflection,\nideas"]
  presenting -> experimenting [label="ideas"]
  experimenting -> presenting [label="improvements"]
}

I created it with the command:

dot -Nfontsize=10 -Efontsize=11 FILENAME -o OUTPUTFILENAME -Tpng

The result:

Directed graph

LifeCampTO social graph

Posted: - Modified: | connecting, social

After LifeCampTO, I asked people to give me the list of people they wanted to talk to (or, well, those people’s primary keys ;) ). I’m still figuring out how to do a great little mail merge that reminds people of the keywords, but along the way, I thought I might I’d learn more about network visualization.

Here’s the resulting graph: (click on it for a larger version)

LifeCampTO social graph

So, what does this graph say?

You can see that most people have quite a lot of follow-up conversations ahead. It wasn’t the kind of event where most people walked away with only two or three conversations, although they might have smaller follow-up conversations with different groups of people. It might be interesting to do some cluster analysis around topics, and maybe someday I’ll figure out how to encode the data in order to make that analysis easier. ;) Based on this, our on-the-fly decision to have three big conversations turned out to have made sense, although it would also be interesting to try having small conversations about both popular and niche topics, and then having people come together at the end (or on a wiki).

Getting to this graph (and to the individualized graphs I’ve just figured out how to produce – it highlights each person’s connections) involved a lot of bubblegum and string.

  1. I typed in the data people had written down, using OpenOffice.org to form the upper triangle of an adjacency matrix. Two people’s sheets were missing, and one person didn’t have any connections incoming or outgoing. =( Thank you, programming competitions, for all those lovely data structures.
  2. I copied the adjacency matrix and pasted it onto itself using OOo’s Paste Special – Transpose, Skip Empty Cells. This gave me a full adjacency matrix.
  3. I used a really long and hairy OOo formula to concatenate the cells into Emacs Lisp code as an associative list, with extra information and an edge list.
  4. I copied that into Emacs and processed the associative list’s edges. I needed to do that anyway in order to be able to e-mail people personalized e-mail with all of their introductions, instead of sending one e-mail per edge. Along the way, I got the idea of visualizing the network diagram, so I spun off some code to output a full edge list in DOT format for visualization with circo.
  5. I used a command like
    circo -Gsplines=true < lifecampto.dot -Tpng > lifecampto.png

    to generate the graph shown.

  6. Then I thought it would be cool to personalize the graphs, too, so I wrote some more Emacs Lisp to generate personalized DOT files that highlighted the recipient in green and the recipient’s requested links/nodes in green, too. I used a Bash for loop to turn all those personalized DOT files into PNG files.

Example of a personalized image:

Tomorrow, I’ll work on the mail merge. =)

A little computer science is a dangerous, dangerous thing.