In my upcoming paper on how to measure tipping points, robustness, and path dependence I plan to provide examples in the form of illustrations. Since the technique uses Markov modeling to measures these properties of system dynamics my illustrations are (not surprisingly) going to be Markov diagrams that provide examples of the definitions and applications of the algorithms. Eventually I will create software in Java to run these analyses and these will produce a visual output; so one option is to build that software now and use screenshot for my diagrams. The problem is that it is quite hard to get java to output exactly what I want and have it look the way I want it. My answer came in the form of Mathematica 6.

This newest version of Mathematica includes a huge boost in its visualization capabilities, especially for graphs, network diagrams, and all other node/edge constructs. In the long-term I can create the java program with the visual output, but export a properly formatted Mathematica notebook to create the diagrams for paper inclusion. In the short-term I can input my Markov models in Mathematica as matrices and simultaneously use the analytical power of the Combinatorica package and the slick graphics of the new GraphPlot command. As nice as this sounds, many hurdles must be overcome.

The first problem is that Combinatorica and GraphPlot don't talk to each other very well. GraphPlot can simply draw a graph created/defined with Combinatorica, but many of the setting and options (such as edge weighting and labels) aren't transferred. They also interpret 0s and empty slots in the matrix differently…which is especially bad since there are only two ways to do it. I overcame this by converting the weighted edge list to a string and then used a series of string replacements to get it into the format that GraphPlot needs to draw the draw with weights and labels for the weights. What a pain for something that should have been native to the Mathematica code.

A constant hurdle using Mathematica is its cryptic syntax, uninformative error messages, and lack of a true documentation. The online and help index examples are too limited for patterns of usage to be discernable and no explanations are given in most cases. What I'd like is something more like the Java API documentation that provides exhaustive lists of the options and descriptions of how they're used. The visual examples (something the java API docs lack) are great, but they are not always sufficient. Maybe this exists somewhere, but I can't find it. Anyway, enough complaining. I've figured out through a lot of trial and error how to draw Markov diagrams that look the way one would expect within Mathematica (with a few variations). In order to save other people the time and frustration to figure this out I've posted it here (and made it available as a notebook). Enjoy! Feel free to send me a note if you have found this to be helpful or you have ways to improve it.

The next step for me is to color code the nodes based on network properties and lay the network on top of a contour graph that represents the sets of nodes with similar measures. It won't be easy, but once I've figured it out I'll post that here too. If it's too hard then I'll do the coloring in Photoshop for now and then figure it out later (after the paper is approved for my prelim). Obviously, if you've done any of this (or are just good at working with Mathematica) and can offer me some advice then it is very welcome (email me at aaronbramson@gmail.com).

Various versions of a sample Markov diagram


Download the Mathematica Notebook
(right click and "save link as" if it opens as a text file when clicked)

Various versions of a sample Markov diagram