California Investment Network

Recent Blog

Pitching Help Desk


"I have been impressed with the level of contacts that I have yielded from your site. We certainly will be using the site again for capital raises for our projects. "
Aaron L.

 BLOG >> Recent

Layout, Weights, and Highlighting with Graphviz [Decision Trees
Posted on August 8, 2013 @ 01:56:00 AM by Paul Meagher

I introduced the Graphviz program in my last blog. In today's blog I want to go a little deeper into the DOT language to show how you can achieve three useful effects using the DOT language. The three effects are:

  • Change the overall layout of the graph. Instead of starting our decision tree from the top, I would prefer to start it from the left side of the canvas and expand it towards the right side of the canvas (i.e., left-to-right reading order). I can do this by adding the command rankdir=LR; to my dot file.
  • Would be nice to show probability values on links going into event nodes. For example, the probability of high rain fall this season. We do this by adding a bracket next to link commands and specifying the value for the "label" attribute (e.g., Action -> HighRainFall[label="0.6"];).
  • If you are trying to highlight a path through a decision tree, then there are ways to highlight a path in graphviz. One way would be to thicken the line and add red coloration to each link in the path (e.g., Action -> LowRainFall[label="0.4",color=red,penwidth=3.0]; ).

If we put all these elements together in one dot program file, it would look like this:

digraph { 

  Action -> LowRainFall[label="0.4",color=red,penwidth=3.0]; 
  Action -> HighRainFall[label="0.6"]; 


If we load this dot file into the graphviz program "dot", it will generate this graph:

What we have here is a fragment of a graph. A fragment like this might appear in your decision tree leading from an action node to an event node. This is how we can get probabilities to appear on our graphical representations of a decision problem. Also, I like to orient the tree from left-to-right because if you have a large branchy tree it can more easily be printed off whereas top-to-bottom trees are hard to print off and involve alot of horizontal scrolling to view. Finally, when you make a decision to pursue a particular course of action, you can highlight that course of action graphically with a thick red pen effect.




 Agriculture [70]
 Bayesian Inference [14]
 Books [15]
 Business Models [24]
 Causal Inference [2]
 Creativity [7]
 Decision Making [15]
 Decision Trees [8]
 Design [36]
 Eco-Green [4]
 Economics [11]
 Education [10]
 Energy [0]
 Entrepreneurship [59]
 Events [2]
 Farming [20]
 Finance [25]
 Future [15]
 Growth [18]
 Investing [24]
 Lean Startup [10]
 Leisure [5]
 Lens Model [9]
 Making [1]
 Management [9]
 Motivation [3]
 Nature [22]
 Patents & Trademarks [1]
 Permaculture [34]
 Psychology [1]
 Real Estate [2]
 Robots [1]
 Selling [11]
 Site News [14]
 Startups [12]
 Statistics [3]
 Systems Thinking [3]
 Trends [7]
 Useful Links [3]
 Valuation [1]
 Venture Capital [5]
 Video [2]
 Writing [2]