7 # define MISC_GRAPH_HXX
26 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
31 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
36 return boost::add_vertex(l, *
this);
54 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
61 std::string graphtype = boost::is_undirected(*
this) ?
"graph" :
"digraph";
62 std::string link = boost::is_undirected(*
this) ?
"--" :
"->";
63 ostr <<
"/* Graph Visualization */" << std::endl;
65 ostr << graphtype <<
" \"" << name_get() <<
"\" {" << std::endl
66 <<
" node [shape=box];" << std::endl;
70 for (tie(vi, vi_end) = boost::vertices(*
this); vi != vi_end; ++vi)
72 ostr <<
" \"" << *vi <<
"\" "
74 vertex_print(*vi, ostr);
75 ostr <<
"\"]" << std::endl;
80 for (tie(ei, ei_end) = boost::edges(*
this); ei != ei_end; ++ei)
82 std::ostringstream label;
83 label <<
deref <<(*this)[*ei];
84 ostr <<
" \"" << boost::source(*ei, *
this) <<
"\" "
87 if (label.str() !=
"")
88 ostr <<
" [label=\"" << label.str() <<
"\"]";
94 return ostr <<
"}" << std::endl;
97 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
105 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
112 static unsigned cpt = 0;
115 std::stringstream sstr;
116 sstr <<
"graph-" << cpt++ <<
".gv";
121 ofs.open(file.c_str());
126 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
131 return boost::get_property(static_cast<const super_type&>(*
this),
135 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
140 boost::set_property(*
this, boost::graph_name, name);
143 template <
typename Orientation,
typename VertexLabel,
typename EdgeLabel>
148 return g.
print(ostr);
161 template <
typename VertexLabel,
typename EdgeLabel>
166 template <
typename VertexLabel,
typename EdgeLabel>
171 boost::add_edge(v1, v2, *
this);
176 template <
typename NodeLabel,
typename EdgeLabel>
177 std::list<typename directed_graph<NodeLabel, EdgeLabel>::vertex_descriptor>
180 std::list<vertex_descriptor> res;
191 template <
typename VertexLabel,
typename EdgeLabel>
196 template <
typename VertexLabel,
typename EdgeLabel>
202 boost::add_edge(v2, v1, *
this);
204 boost::add_edge(v1, v2, *
this);
209 #endif // !MISC_GRAPH_HXX