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
2de7ad34
Commit
2de7ad34
authored
Aug 28, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_parallel.hh: cosmetic functor -> function conversion
parent
2b51e4b5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
80 deletions
+71
-80
src/graph/stats/graph_parallel.cc
src/graph/stats/graph_parallel.cc
+3
-3
src/graph/stats/graph_parallel.hh
src/graph/stats/graph_parallel.hh
+68
-77
No files found.
src/graph/stats/graph_parallel.cc
View file @
2de7ad34
...
...
@@ -36,7 +36,7 @@ void do_label_parallel_edges(GraphInterface& gi, boost::any property,
(
gi
,
[
&
](
auto
&&
graph
,
auto
&&
a2
)
{
return
label_parallel_edges
()
return
label_parallel_edges
(
std
::
forward
<
decltype
(
graph
)
>
(
graph
),
std
::
forward
<
decltype
(
a2
)
>
(
a2
),
mark_only
);
},
...
...
@@ -50,7 +50,7 @@ void do_label_self_loops(GraphInterface& gi, boost::any property,
(
gi
,
[
&
](
auto
&&
graph
,
auto
&&
a2
)
{
return
label_self_loops
()
return
label_self_loops
(
std
::
forward
<
decltype
(
graph
)
>
(
graph
),
std
::
forward
<
decltype
(
a2
)
>
(
a2
),
mark_only
);
},
...
...
@@ -63,7 +63,7 @@ void do_remove_labeled_edges(GraphInterface& gi, boost::any property)
(
gi
,
[
&
](
auto
&&
graph
,
auto
&&
a2
)
{
return
remove_labeled_edges
()
return
remove_labeled_edges
(
std
::
forward
<
decltype
(
graph
)
>
(
graph
),
std
::
forward
<
decltype
(
a2
)
>
(
a2
));
},
...
...
src/graph/stats/graph_parallel.hh
View file @
2de7ad34
...
...
@@ -28,11 +28,9 @@ using namespace std;
using
namespace
boost
;
// label parallel edges in the order they are found, starting from 1
struct
label_parallel_edges
template
<
class
Graph
,
class
ParallelMap
>
void
label_parallel_edges
(
const
Graph
&
g
,
ParallelMap
parallel
,
bool
mark_only
)
{
template
<
class
Graph
,
class
ParallelMap
>
void
operator
()(
const
Graph
&
g
,
ParallelMap
parallel
,
bool
mark_only
)
const
{
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
typename
property_map
<
Graph
,
edge_index_t
>::
type
eidx
=
get
(
edge_index
,
g
);
...
...
@@ -82,15 +80,12 @@ struct label_parallel_edges
vset
.
clear
();
self_loops
.
clear
();
});
}
};
}
// label self loops edges in the order they are found, starting from 1
struct
label_self_loops
template
<
class
Graph
,
class
SelfMap
>
void
label_self_loops
(
const
Graph
&
g
,
SelfMap
self
,
bool
mark_only
)
{
template
<
class
Graph
,
class
SelfMap
>
void
operator
()(
const
Graph
&
g
,
SelfMap
self
,
bool
mark_only
)
const
{
parallel_vertex_loop
(
g
,
[
&
](
auto
v
)
...
...
@@ -104,15 +99,12 @@ struct label_self_loops
put
(
self
,
e
,
0
);
}
});
}
};
// remove edges with label larger than 0
struct
remove_labeled_edges
template
<
class
Graph
,
class
LabelMap
>
void
remove_labeled_edges
(
Graph
&
g
,
LabelMap
label
)
{
template
<
class
Graph
,
class
LabelMap
>
void
operator
()(
Graph
&
g
,
LabelMap
label
)
const
{
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
vector
<
edge_t
>
r_edges
;
for
(
auto
v
:
vertices_range
(
g
))
...
...
@@ -129,8 +121,7 @@ struct remove_labeled_edges
r_edges
.
pop_back
();
}
}
}
};
}
}
// graph_tool namespace
...
...
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