All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
NetworKit::GraphTools Namespace Reference

Functions

Graph getCompactedGraph (const Graph &graph, std::unordered_map< node, node > &nodeIdMap)
 Computes a graph with the same structure but with continuous node ids. More...
 
std::unordered_map< node, nodegetContinuousNodeIds (const Graph &graph)
 Computes a map of node ids. More...
 
std::unordered_map< node, nodegetRandomContinuousNodeIds (const Graph &graph)
 Computes a map of random node ids. More...
 
std::vector< nodeinvertContinuousNodeIds (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. More...
 
Graph restoreGraph (std::vector< node > &invertedIdMap, const Graph &G)
 Constructs a new graph that has the same node ids as before it was compacted. More...
 

Function Documentation

Graph NetworKit::GraphTools::getCompactedGraph ( const Graph &  graph,
std::unordered_map< node, node > &  nodeIdMap 
)

Computes a graph with the same structure but with continuous node ids.

Parameters
graphThe graph to be compacted.
nodeIdMapThe map providing the information about the node ids.
Returns
Returns a compacted Graph.
std::unordered_map< node, node > NetworKit::GraphTools::getContinuousNodeIds ( const Graph &  graph)

Computes a map of node ids.

Parameters
graphThe graph of which the node id map is wanted.
Returns
Returns the node id map.
std::unordered_map< node, node > NetworKit::GraphTools::getRandomContinuousNodeIds ( const Graph &  graph)

Computes a map of random node ids.

Parameters
graphThe graph of which the node id map is wanted.
Returns
Returns the node id map.
std::vector< node > NetworKit::GraphTools::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.

Parameters
nodeIdMapThe mapping from node ids with gaps to continuous node ids (i.e. from )
GThe compacted graph (currently only needed for the upper node id bound)
Returns
A vector of nodes id where the index is the node id of the compacted graph and the value is the node id of the noncontinuous graph.
Graph NetworKit::GraphTools::restoreGraph ( std::vector< node > &  invertedIdMap,
const Graph &  G 
)

Constructs a new graph that has the same node ids as before it was compacted.

Parameters
invertedIdMapThe node id mapping from continuous node ids to noncontinuous node ids.
GThe compacted graph.
Returns
The original graph.