Template Function NetworKit::GraphTools::getRemappedGraph(const Graph&, count, UnaryIdMapper&&, SkipEdgePredicate&&, bool)

Function Documentation

template<typename UnaryIdMapper, typename SkipEdgePredicate>
Graph NetworKit::GraphTools::getRemappedGraph(const Graph &graph, count numNodes, UnaryIdMapper &&oldIdToNew, SkipEdgePredicate &&skipNode, bool preallocate = true)

Rename nodes in a graph using a callback which translates each old id to a new one. For each node u in input graph, oldIdToNew(u) < numNodes.

@node preallocate is currently not implemented

Parameters:
  • graph – Input graph.

  • numNodes – Number of nodes in the output graph.

  • oldIdToNew – Translate old id to new ones. Must be thread-safe

  • skipNode – Skip all nodes (and incident edges) for old node ids u where deleteNode(u) == true, Must be thread-safe

  • preallocate – Preallocates memory before adding neighbors (Preallocation does not account for deleted nodes and hence may need more memory)