Commit 2de7ad34 authored by Tiago Peixoto's avatar Tiago Peixoto

graph_parallel.hh: cosmetic functor -> function conversion

parent 2b51e4b5
......@@ -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));
},
......
......@@ -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
......
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