Boost C++ Libraries: Ticket #2032: write_graphviz VertexList problem https://svn.boost.org/trac10/ticket/2032 <p> hi all, the following code compiles fine: </p> <div class="wiki-code"><div class="code"><pre><span class="n">include</span> <span class="o">&lt;</span><span class="n">boost</span><span class="o">/</span><span class="n">graph</span><span class="o">/</span><span class="n">adjacency_list</span><span class="p">.</span><span class="n">hpp</span><span class="o">&gt;</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/graph/graphviz.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">adjacency_list</span><span class="o">&lt;</span><span class="n">boost</span><span class="o">::</span><span class="n">setS</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">vecS</span> <span class="o">&gt;</span> <span class="n">graph_t</span><span class="p">;</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="n">graph_t</span> <span class="n">graph</span><span class="p">;</span> <span class="n">boost</span><span class="o">::</span><span class="n">write_graphviz</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="p">,</span> <span class="n">graph</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> changing the VertexList type from vecS to listS, the code doesn't compile any more: </p> <div class="wiki-code"><div class="code"><pre><span class="n">include</span> <span class="o">&lt;</span><span class="n">boost</span><span class="o">/</span><span class="n">graph</span><span class="o">/</span><span class="n">adjacency_list</span><span class="p">.</span><span class="n">hpp</span><span class="o">&gt;</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/graph/graphviz.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">adjacency_list</span><span class="o">&lt;</span><span class="n">boost</span><span class="o">::</span><span class="n">setS</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">listS</span> <span class="o">&gt;</span> <span class="n">graph_t</span><span class="p">;</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="n">graph_t</span> <span class="n">graph</span><span class="p">;</span> <span class="n">boost</span><span class="o">::</span><span class="n">write_graphviz</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="p">,</span> <span class="n">graph</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> i tested it with gcc-4.2 and gcc-4.3 ... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2032 Trac 1.4.3 Douglas Gregor Tue, 24 Jun 2008 15:47:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2032#comment:1 https://svn.boost.org/trac10/ticket/2032#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> You need to pass a vertex index property map into write_graphviz, because it is not provided automatically when VertexListS=listS. </p> Ticket jleandro@… Thu, 03 Feb 2011 13:30:46 GMT <link>https://svn.boost.org/trac10/ticket/2032#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2032#comment:2</guid> <description> <p> So, HOW to "pass a vertex index property map" into write_graphviz? Does anyone has a snippet code to show it? I'm failing on trying different syntaxes, such as: </p> <p> typedef boost::property_map&lt;Graph, boost::vertex_index_t&gt;::type <a class="missing wiki">IndexMap</a>; </p> <p> <a class="missing wiki">IndexMap</a> node_index = get(boost::vertex_index, g); </p> <p> boost::write_graphviz(dotfile, g, <a class="missing wiki">OurVertexPropertyWriter</a>(node_name), boost::default_writer(), boost::default_writer(), get(boost::vertex_index,g)); </p> <p> OR </p> <p> boost::write_graphviz(dotfile, g, <a class="missing wiki">OurVertexPropertyWriter</a>(node_name), boost::default_writer(), boost::default_writer(), node_index); </p> <p> OR </p> <p> boost::write_graphviz(dotfile, g, <a class="missing wiki">OurVertexPropertyWriter</a>(node_name), boost::default_writer(), boost::default_writer(), make_iterator_property_map(intIndex.begin(), get(boost::vertex_index, g), intIndex<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>)); </p> <p> I'd appreciate any piece of code on that. </p> <p> Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Thu, 03 Feb 2011 23:03:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2032#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2032#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2032#comment:2" title="Comment 2">jleandro@…</a>: </p> <p> Please ask questions like this on the boost-users mailing list, not in Trac tickets. </p> </description> <category>Ticket</category> </item> </channel> </rss>