29 Kasım 2016 Salı

graph read_graphml metodu

Giriş
Bu metodu read_graphviz ile kardeş.

Elimizde şöyle bir graph olsun
typedef  boost::labeled_graph<boost::adjacency_list<
        boost::listS, boost::vecS, boost::directedS,
        Vertex, Edge>, int> Graph;
 Graph graph;
Şöyle yaparız.
boost::dynamic_properties dp(boost::ignore_other_properties);

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

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

std::ifstream dot ("inputpath");
boost::read_graphml(dot, graph, dp);

Hiç yorum yok:

Yorum Gönder