20 #ifndef GRAPH_PARALLEL_TOOLS_H
21 #define GRAPH_PARALLEL_TOOLS_H
23 #include <tulip/Graph.h>
24 #include <tulip/ParallelTools.h>
30 template <
typename NodeIndexFunction>
31 void inline TLP_MAP_NODES_AND_INDICES(
const tlp::Graph *graph,
32 const NodeIndexFunction &nodeIndexFunction) {
34 for (
auto n : graph->
nodes()) {
35 nodeIndexFunction(n, i++);
65 template <
typename NodeFunction>
67 TLP_PARALLEL_MAP_VECTOR<tlp::node, NodeFunction>(graph->
nodes(), nodeFunction);
97 template <
typename NodeFunction>
99 const NodeFunction &nodeFunction) {
100 TLP_PARALLEL_MAP_VECTOR_AND_INDICES<tlp::node, NodeFunction>(graph->
nodes(), nodeFunction);
105 template <
typename EdgeIndexFunction>
106 void inline TLP_MAP_EDGES_AND_INDICES(
const tlp::Graph *graph,
107 const EdgeIndexFunction &edgeIndexFunction) {
109 for (
auto e : graph->
edges()) {
110 edgeIndexFunction(e, i++);
140 template <
typename EdgeFunction>
142 TLP_PARALLEL_MAP_VECTOR<tlp::edge, EdgeFunction>(graph->
edges(), edgeFunction);
172 template <
typename EdgeFunction>
174 const EdgeFunction &edgeFunction) {
175 TLP_PARALLEL_MAP_VECTOR_AND_INDICES<tlp::edge, EdgeFunction>(graph->
edges(), edgeFunction);
virtual const std::vector< node > & nodes() const =0
Return a const reference on the vector of nodes of the graph It is the fastest way to access to nodes...
virtual const std::vector< edge > & edges() const =0
Return a const reference on the vector of edges of the graph It is the fastest way to access to edges...
void TLP_PARALLEL_MAP_EDGES(const tlp::Graph *graph, const EdgeFunction &edgeFunction)
void TLP_PARALLEL_MAP_EDGES_AND_INDICES(const tlp::Graph *graph, const EdgeFunction &edgeFunction)
void TLP_PARALLEL_MAP_NODES_AND_INDICES(const tlp::Graph *graph, const NodeFunction &nodeFunction)
void TLP_PARALLEL_MAP_NODES(const tlp::Graph *graph, const NodeFunction &nodeFunction)