Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
78399c2c
Commit
78399c2c
authored
Oct 27, 2012
by
Tiago Peixoto
Browse files
Add edge() function to undirected adaptor
parent
b0f284a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/graph_adaptor.hh
View file @
78399c2c
...
...
@@ -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)
//==============================================================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment