Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#2032 closed Bugs (invalid)

write_graphviz VertexList problem

Reported by: tim blechmann <tim@…> Owned by: Douglas Gregor
Milestone: Boost 1.36.0 Component: graph
Version: Boost 1.35.0 Severity: Problem
Keywords: Cc:

Description

hi all, the following code compiles fine:

include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
#include <iostream>

using namespace std;
typedef boost::adjacency_list<boost::setS,
                              boost::vecS
                              > graph_t;

int main()
{
    graph_t graph;
    boost::write_graphviz(std::cout, graph);
}

changing the VertexList type from vecS to listS, the code doesn't compile any more:

include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
#include <iostream>

using namespace std;
typedef boost::adjacency_list<boost::setS,
                              boost::listS
                              > graph_t;

int main()
{
    graph_t graph;
    boost::write_graphviz(std::cout, graph);
}

i tested it with gcc-4.2 and gcc-4.3 ...

Change History (3)

comment:1 by Douglas Gregor, 14 years ago

Resolution: invalid
Status: newclosed

You need to pass a vertex index property map into write_graphviz, because it is not provided automatically when VertexListS=listS.

comment:2 by jleandro@…, 12 years ago

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:

typedef boost::property_map<Graph, boost::vertex_index_t>::type IndexMap;

IndexMap node_index = get(boost::vertex_index, g);

boost::write_graphviz(dotfile, g, OurVertexPropertyWriter(node_name), boost::default_writer(), boost::default_writer(), get(boost::vertex_index,g));

OR

boost::write_graphviz(dotfile, g, OurVertexPropertyWriter(node_name), boost::default_writer(), boost::default_writer(), node_index);

OR

boost::write_graphviz(dotfile, g, OurVertexPropertyWriter(node_name), boost::default_writer(), boost::default_writer(), make_iterator_property_map(intIndex.begin(), get(boost::vertex_index, g), intIndex[0]));

I'd appreciate any piece of code on that.

Thanks.

in reply to:  2 comment:3 by Jeremiah Willcock, 12 years ago

Replying to jleandro@…:

Please ask questions like this on the boost-users mailing list, not in Trac tickets.

Note: See TracTickets for help on using tickets.