Bases: object
Appends graph G1 to graph G as a new subgraph. Performs node id remapping.
G (networkit.Graph) – Graph where G1 will be appended to.
G1 (networkit.Graph) – Graph that will be appended to G.
Augments the input graph in-place as required by ForestCentrality. With respect to the input graph G, the augmented graph has a new root node connected to all the other nodes in the graph.
G (networkit.Graph) – The input graph (undirected).
Returns the node id of the new root node.
int
Copies all nodes of the input graph to a new graph (edges are not copied).
graph (networkit.Graph) – The input graph.
graph – Graph with the same nodes as the input graph (and without any edge).
networkit.Graph
Constructs an augmented graph as required by ForestCentrality. With respect to the input graph G, the augmented graph has a new root node connected to all the other nodes in the graph.
G (networkit.Graph) – The input graph (undirected).
Returns a tuple (G, root) where G is the augmented graph and root is the id of the root node.
tuple(networkit.Graph, int)
Get the density of the input graph.
graph (networkit.Graph) – The input graph.
The density of the input graph.
float
Computes a graph with the same structure but with continuous node ids.
graph (networkit.Graph) – The graph to be compacted.
nodeIdMap (list(int)) – The map providing the information about the node ids.
The compacted graph
networkit.Graph
Computes a map of node ids to continuous node ids.
graph (networkit.Graph) – The graph of which the node id map is wanted.
Returns the node id map
list(int)
getRandomContinuousNodeIds(graph):
Computes a map of node ids to continuous, randomly permutated node ids.
graph (networkit.Graph) – The graph of which the node id map is wanted.
Returns the node id map
list(int)
Get the inVolume (for all incoming edges) of a subgraph, defined by the input graph and a corresponding subset of nodes.
graph (networkit.Graph) – The input graph.
nodes (list(int)) – A vector of nodes from the graph.
The inVolume of the input graph.
float
Returns the maximum out-degree of the graph.
G (networkit.Graph) – The input graph.
The maximum out-degree of the graph.
int
Returns the maximum in-degree of the graph.
G (networkit.Graph) – The input graph.
The maximum in-degree of the graph.
int
Returns the maximum weighted out-degree of the graph.
G (networkit.Graph) – The input graph.
The maximum weighted out-degree of the graph.
float
Returns the maximum weighted in-degree of the graph.
G (networkit.Graph) – The input graph.
The maximum weighted in-degree of the graph.
float
Modifies graph G to be the union of it and graph G1. Nodes with the same ids are identified with each other.
G (networkit.Graph) – Result of the merge.
G1 (networkit.Graph) – Graph that will be merged with G.
Get a random edge of the graph.
Notes
Fast, but not uniformly random if uniformDistribution is not set, slow and uniformly random otherwise.
G (networkit.Graph) – The input graph.
uniformDistribution (bool, optional) – If the distribution of the edge shall be uniform. Default: False
Random edge.
tuple(int, int)
Returns a list with numEdges random edges. The edges are chosen uniformly at random.
G (networkit.Graph) – The input graph.
numEdges (int) – The number of edges to choose.
List of with numEdges random edges.
list(tuple(int, int))
Returns a random neighbor of node u.
G (networkit.Graph) – The input graph.
u (int) – A node in G.
A random neighbor of u.
int
Returns a random node of the input graph.
G (networkit.Graph) – The input graph.
A random node.
int
Returns n distinct random nodes of the input graph.
G (networkit.Graph) – The input graph.
n (int) – The number of desired nodes.
A list of distinct random nodes.
list(int)
Randomizes the weights of the given graph. The weights are uniformly distributed in the range [0, 1] by default, unless a different distribution is provided. However it is only strictly in-place for already weighted graphs. For unweighted graphs a copy is created before randomizing weights.
G (networkit.Graph) – The input graph.
Efficiently removes all the edges adjacent to a set of nodes that is not connected to the rest of the graph. This is meant to optimize the Kadabra algorithm.
G (networkit.Graph) – The input graph.
nodes (list(int)) – Isolates set of nodes from where the edges will be removed.
Return the size of the graph.
a pair (n, m) where n is the number of nodes and m is the number of edges.
tuple(int, int)
Sorts the adjacency arrays by edge weight.
G (networkit.Graph) – The input graph.
decreasing (bool, optional) – If True adjacency arrays are sorted by non-increasing edge weights, if False adjacency arrays are sorted by non-decreasing edge weights. Ties are broken by using node ids. Default: False
Returns an induced subgraph of this graph (including potential edge weights/directions)
There a two relevant sets of nodes:
Nodes are such passed as arguments.
Neighbors are empty by default.
The subgraph contains all nodes in Nodes + Neighbors and all edges which have one end point in Nodes and the other in Nodes or Neighbors.
graph (networkit.Graph) – The input graph.
nodes (list(int)) – Nodes in the induced subgraph.
includeOutNeighbors (bool, optional) – If set to True, out-neighbors will also be included. Default: False
includeInNeighbors (bool, optional) – If set to True, in-neighbors will also be included. Default: False
graph – Induced subgraph.
networkit.Graph
graph (networkit.Graph) – The input graph.
nodes (list(int)) – Nodes in the induced subgraph.
compact (bool, optional) – Indicates whether the resulting graph shall have compact, continuous node ids. If False node ids of the input graph are kept. Default: False
graph – Induced subgraph of the input graph (including potential edge/weight directions).
networkit.Graph
Returns an undirected copy of the input graph.
graph (networkit.Graph) – The input graph.
graph – Undirected copy of the input graph.
networkit.Graph
Returns an unweighted copy of the input graph.
graph (networkit.Graph) – The input graph.
graph – Unweighted copy of the input graph.
networkit.Graph
Returns a weighted copy of the input graph.
graph (networkit.Graph) – The input graph.
graph – Weighted copy of the input graph.
networkit.Graph
Given a directed graph G, the topology sort algorithm creates one valid topology order of nodes. Undirected graphs are not accepted as input, since a topology sort is a linear ordering of vertices such that for every edge u -> v, node u comes before v in the ordering. Node ids must either be continuous or you must provide a continuous node id mapping.
G (networkit.Graph) – The directed input graph.
nodeIdMap (dict(int, int), optional) – Optional continuous node id mapping.
checkMapping (bool, optional) – Flag to determine if the node id mapping should be checked that it is continuous. This check takes O(|V|) time and space.
Returns the transpose of the input graph. The graph must be directed.
graph (networkit.Graph) – The input graph.
graph – Transpose of the input graph.
networkit.Graph
Get the volume (for all outgoing edges) of a graph. If a list of nodes of the graph is given, the volume for the corresponding subgraph is computed.
graph (networkit.Graph) – The input graph.
nodes (list(int), optional) – List of nodes from the graph.
The volume of the subgraph.
float