0

i dont know how to load a graph from graphml file with boost. I'm able to save a graphml file, but loading is not possible.

My Graph has the type

 typedef  boost::labeled_graph<boost::adjacency_list<
        boost::listS, boost::vecS, boost::directedS,
        Vertex, Edge>, int> Graph;
 Graph graph;

My loading function looks like.

boost::dynamic_properties dp(boost::ignore_other_properties);

dp.property("IdV", boost::get(&Vertex::ID, graph.graph()));
dp.property("LabelV", boost::get(&Vertex::Name, graph.graph()));
dp.property("TypeV", boost::get(&Vertex::Type, graph.graph()));

dp.property("WeightE", boost::get(&Edge::Weight, graph.graph()));
dp.property("TypeE", boost::get(&Edge::Type, graph.graph()));
dp.property("LabelE", boost::get(&Edge::Name, graph.graph()));

std::ifstream dot(std::string(inputPath) + "");
boost::read_graphml(dot, graph.graph(), dp);

I get this error message:

[ilink64 Error] Error: Unresolved external 'boost::read_graphml(std::istream&, boost::mutate_graph&, unsigned long long)' referenced from ...\GRAPH_UNIT.O

Can someone give me a good and simple example, how to read a graphml file in boost. I just found following 2 examples - I think my code is the same?

Boost read_graphml example and https://stackoverflow.com/questions/16667175/using-vertex-name-when-reading-a-graphml-file-with-boost-graph

or can someone see the error in my code?

Best Michael

Community
  • 1
  • 1
Jacks
  • 67
  • 5

1 Answers1

0

The Boost.Graph library is not a header only library when using, e. g., read_graphml(). You just need to link to the boost graph library, see also boost::read_graphml visual studio 2013.

Community
  • 1
  • 1
CodeFinder
  • 21
  • 1
  • 2