title: Computing a dominator graph using Boost's Lengauer Tarjan algorithm and display it using graphviz
body: <p>Let me first of all apologize in case I have violated the rules, as I am aware my question has already been asked in a modified way here: <a href="https://stackoverflow.com/questions/18091758/lengauer-tarjan-algorithm-in-bgl-boost-graph-library">Lengauer Tarjan Algorithm in BGL (boost graph library)</a>. However, I am (still) unable to use the answer in order to display the result correctly.</p>
  
  <p>To be more precise: I followed the answer linked and have sucessfully applied the Lengauer-Tarjan algorithm to my graph (which for convenience is part of the Boost documentation: <a href="http://www.boost.org/doc/libs/1_55_0/libs/graph/test/dominator_tree_test.cpp" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_55_0/libs/graph/test/dominator_tree_test.cpp</a>). Now, if understand the code correctly the relevant information about the dominator tree is stored in domTreePredMap which is of type PredMap:</p>
  
  <pre><code>const int numOfVertices = testSet[i].numOfVertices;
  //See example for test_sets - it just the same routine
  G g(
    testSet[i].edges.begin(), testSet[i].edges.end(),
    numOfVertices);
  
  typedef graph_traits&lt;G&gt;::vertex_descriptor Vertex;
  typedef property_map&lt;G, vertex_index_t&gt;::type IndexMap;
  typedef
    iterator_property_map&lt;vector&lt;Vertex&gt;::iterator, IndexMap&gt;
    PredMap;
  
  vector&lt;Vertex&gt; domTreePredVector, domTreePredVector2;
  IndexMap indexMap(get(vertex_index, g));
  graph_traits&lt;G&gt;::vertex_iterator uItr, uEnd;
  int j = 0;
  for (tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr, ++j)
  {
    put(indexMap, *uItr, j);
  }
  
  // Lengauer-Tarjan dominator tree algorithm
  domTreePredVector =
    vector&lt;Vertex&gt;(num_vertices(g), graph_traits&lt;G&gt;::null_vertex());
  PredMap domTreePredMap =
    make_iterator_property_map(domTreePredVector.begin(), indexMap);
  
  lengauer_tarjan_dominator_tree(g, vertex(0, g), domTreePredMap);`
  </code></pre>
  
  <p>For me one of the main advantages of Boost is the possibility to automatically generated graphical output using graphviz with write_graphviz(cout, g), where g is a graph from typedef G:</p>
  
  <pre><code>typedef adjacency_list&lt;
      listS,
      listS,
      bidirectionalS,
      property&lt;vertex_index_t, std::size_t&gt;, no_property&gt; G;
  </code></pre>
  
  <p>However, I am unable to translate the DomTreePredMap into something write_graphviz(cout, X) can understand. I appreciate any help outlining how a graph can be constructed from the domTreePredMap, which can be printed using graphviz.</p>
  
  <p>Thank you all for reading all this and helping me out. </p>