void writeEGDot(SmartGraph& g, SmartGraph::EdgeMap<double>& length, ostream& out, SmartGraph::NodeMap<IndexPair>& edgePairs, boost::unordered_set<unsigned>& matched) { out << "graph name {" << endl; out << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl; for (SmartGraph::NodeIt n(g); n != INVALID; ++n) { IndexPair p = edgePairs[n]; if(p.first != p.second) out << " n" << g.id(n) << " [ label=\"" << p.first << ":" << p.second << "\" ]; " << endl; else out << " n" << g.id(n) << " [ shape=triangle, label=\"" << p.first << "\" ]; \n"; } out << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl; for (SmartGraph::EdgeIt e(g); e != INVALID; ++e) { string extra = ""; if(matched.count(g.id(e))) extra = "style = bold, "; out << " n" << g.id(g.u(e)) << " -- " << " n" << g.id(g.v(e)) << " [ " << extra << "label=\"" << length[e] << "\" ]; " << endl; } out << "}" << endl; }
//write dot file from graph void writeDot(SmartGraph& g, SmartGraph::EdgeMap<double>& length, SmartGraph::NodeMap<unsigned>& index, ostream& out) { out << "graph name {" << endl; out << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl; for (SmartGraph::NodeIt n(g); n != INVALID; ++n) { out << " n" << g.id(n) << " [ label=\"" << index[n] << "\" ]; " << endl; } out << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl; for (SmartGraph::EdgeIt e(g); e != INVALID; ++e) { out << " n" << g.id(g.u(e)) << " -- " << " n" << g.id(g.v(e)) << " [ label=\"" << length[e] << "\" ]; " << endl; } out << "}" << endl; }