GraphTools.h
Go to the documentation of this file.
1 #ifndef GRAPHTOOLS_H
2 #define GRAPHTOOLS_H
3
4 #include <unordered_map>
5 #include "../graph/Graph.h"
6
7 namespace NetworKit {
8
9 namespace GraphTools {
10
11
18 Graph getCompactedGraph(const Graph& graph, std::unordered_map<node,node>& nodeIdMap);
19
25 std::unordered_map<node,node> getContinuousNodeIds(const Graph& graph);
26
32 std::unordered_map<node, node> getRandomContinuousNodeIds(const Graph& graph);
33
34
41 std::vector<node> invertContinuousNodeIds(std::unordered_map<node,node>& nodeIdMap, const Graph& G);
42
49 Graph restoreGraph(std::vector<node>& invertedIdMap, const Graph& G);
50
51
52
53
54 } // namespace GraphTools
55
56 } // namespace NetworKit
57
58 #endif // GRAPHTOOLS_H
std::vector< node > invertContinuousNodeIds(std::unordered_map< node, node > &nodeIdMap, const Graph &G)
Inverts a given mapping of node ids from a graph with deleted nodes to continuous node ids...
Definition: GraphTools.cpp:48
std::unordered_map< node, node > getContinuousNodeIds(const Graph &graph)
Computes a map of node ids.
Definition: GraphTools.cpp:19
std::unordered_map< node, node > getRandomContinuousNodeIds(const Graph &graph)
Computes a map of random node ids.
Definition: GraphTools.cpp:29
Graph restoreGraph(std::vector< node > &invertedIdMap, const Graph &G)
Constructs a new graph that has the same node ids as before it was compacted.
Definition: GraphTools.cpp:60
Graph getCompactedGraph(const Graph &graph, std::unordered_map< node, node > &nodeIdMap)
Computes a graph with the same structure but with continuous node ids.
Definition: GraphTools.cpp:10