Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
4a1b3817
Commit
4a1b3817
authored
Aug 21, 2009
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes in GraphWrap
Use correct types and always pass GraphWrap objects by value.
parent
dd981325
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
src/graph/graph_util.hh
src/graph/graph_util.hh
+12
-0
src/graph/graph_wrap.hh
src/graph/graph_wrap.hh
+14
-7
No files found.
src/graph/graph_util.hh
View file @
4a1b3817
...
...
@@ -192,6 +192,18 @@ void remove_edge(typename graph_traits
return
remove_edge
(
e
,
const_cast
<
Graph
&>
(
g
.
m_g
));
}
//==============================================================================
//remove_edge(e, reverse_graph<G>)
//==============================================================================
template
<
class
Graph
>
inline
void
remove_edge
(
typename
graph_traits
<
reverse_graph
<
Graph
>
>::
edge_descriptor
e
,
reverse_graph
<
Graph
>&
g
)
{
return
remove_edge
(
e
,
const_cast
<
Graph
&>
(
g
.
m_g
));
}
//==============================================================================
// add_vertex(filtered_graph<G>)
//==============================================================================
...
...
src/graph/graph_wrap.hh
View file @
4a1b3817
...
...
@@ -40,6 +40,9 @@ class GraphWrap
typedef
typename
Graph
::
graph_tag
graph_tag
;
typedef
Graph
orig_graph_t
;
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_descriptor
;
Graph
&
_g
;
GraphInterface
&
_gi
;
};
...
...
@@ -53,6 +56,10 @@ GraphWrap<Graph> graph_wrap(Graph& g, GraphInterface& gi)
template
<
class
Graph
>
struct
graph_traits
<
GraphWrap
<
Graph
>
>:
public
graph_traits
<
Graph
>
{};
template
<
class
Graph
>
struct
graph_traits
<
const
GraphWrap
<
Graph
>
>:
public
graph_traits
<
const
Graph
>
{};
template
<
class
Graph
>
inline
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
source
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
edge_descriptor
e
,
...
...
@@ -165,7 +172,7 @@ inline std::pair<typename graph_traits<GraphWrap<Graph> >::edge_descriptor,
bool
>
add_edge
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
u
,
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
v
,
GraphWrap
<
Graph
>
&
g
)
GraphWrap
<
Graph
>
g
)
{
std
::
pair
<
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
edge_descriptor
,
bool
>
retval
=
add_edge
(
u
,
v
,
g
.
_g
);
...
...
@@ -176,7 +183,7 @@ add_edge(typename graph_traits<GraphWrap<Graph> >::vertex_descriptor u,
template
<
class
Graph
>
inline
void
remove_edge
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
edge_descriptor
e
,
GraphWrap
<
Graph
>
&
g
)
GraphWrap
<
Graph
>
g
)
{
g
.
_gi
.
RemoveEdgeIndex
(
e
);
}
...
...
@@ -185,7 +192,7 @@ template <class Graph>
inline
void
remove_edge
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
u
,
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
v
,
Graph
&
g
)
Graph
Wrap
<
Graph
>
g
)
{
vector
<
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
edge_descriptor
>
removed_edges
;
...
...
@@ -202,7 +209,7 @@ inline void remove_edge
template
<
class
Graph
>
inline
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
add_vertex
(
GraphWrap
<
Graph
>
&
g
)
add_vertex
(
GraphWrap
<
Graph
>
g
)
{
return
add_vertex
(
g
.
_g
);
}
...
...
@@ -210,7 +217,7 @@ add_vertex(GraphWrap<Graph>& g)
template
<
class
Graph
>
inline
void
clear_vertex
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
u
,
GraphWrap
<
Graph
>
&
g
)
GraphWrap
<
Graph
>
g
)
{
typedef
GraphWrap
<
Graph
>
graph_t
;
vector
<
typename
graph_traits
<
graph_t
>::
edge_descriptor
>
del_es
;
...
...
@@ -231,7 +238,7 @@ inline void clear_vertex
template
<
class
Graph
>
inline
void
remove_vertex
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
u
,
GraphWrap
<
Graph
>
&
g
)
GraphWrap
<
Graph
>
g
)
{
clear_vertex
(
u
,
g
);
remove_vertex
(
u
,
g
.
_g
);
...
...
@@ -241,7 +248,7 @@ template <class Graph, class Predicate>
inline
void
remove_out_edge_if
(
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
vertex_descriptor
u
,
Predicate
predicate
,
Graph
&
g
)
Predicate
predicate
,
Graph
Wrap
<
Graph
>
g
)
{
vector
<
typename
graph_traits
<
GraphWrap
<
Graph
>
>::
edge_descriptor
>
removed_edges
;
...
...
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