Commit 78399c2c authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Add edge() function to undirected adaptor

parent b0f284a9
......@@ -450,6 +450,30 @@ edges(const UndirectedAdaptor<Graph>& g)
UndirectedAdaptorEdgeIterator<Graph>(range.second));
}
//==============================================================================
// edge(u, v, g)
//==============================================================================
template <class Graph>
inline
std::pair<typename graph_traits<UndirectedAdaptor<Graph> >::edge_descriptor,
bool>
edge(typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor u,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor v,
const UndirectedAdaptor<Graph>& g)
{
bool reversed = false;
std::pair<typename graph_traits<Graph>::edge_descriptor, bool> res
= edge(u, v, g.OriginalGraph());
if (!res.second)
{
res = edge(v, u, g.OriginalGraph());
reversed = true;
}
return std::make_pair(typename UndirectedAdaptor<Graph>::EdgeDescriptor(res.first, reversed),
res.second);
}
//==============================================================================
// out_edges(u,g)
//==============================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment