# networkit.components

class networkit.components.ConnectedComponents

Bases: object

Determines the connected components and associated values for an undirected graph.

ConnectedComponents(G)

Create ConnectedComponents for Graph G.

G : Graph
The graph.
componentOfNode(self, v)

Get the the component in which node v is situated.

v : node
The node whose component is asked for.
getComponentSizes(self)
getPartition(self)

Get a Partition that represents the components.

Partition
A partition representing the found components.
numberOfComponents(self)

Get the number of connected components.

count:
The number of connected components.
run(self)

This method determines the connected components for the graph given in the constructor.

class networkit.components.DynConnectedComponents

Bases: object

Determines and updates the connected components of an undirected graph.

G : Graph
The graph.
componentOfNode(self, v)

Returns the the component in which node @a u is.

v : node
The node.
getComponentSizes(self)

Returns the map from component to size.

Returns map[index, count]

A map that maps each component to its size.
getComponents(self)

Returns all the components, each stored as (unordered) set of nodes.

Returns vector[vector[node]]

A vector of vectors. Each inner vector contains all the nodes inside the component.
numberOfComponents(self)

Returns the number of components.

Returns count

The number of components.
run(self)
update(self, event)

Updates the connected components after an edge insertion or deletion.

event : GraphEvent
The event that happened (edge deletion or insertion).
updateBatch(self, batch)

Updates the connected components after a batch of edge insertions or deletions.

batch : vector[GraphEvent]
A vector that contains a batch of edge insertions or deletions.
class networkit.components.ParallelConnectedComponents

Bases: object

Determines the connected components and associated values for an undirected graph.

componentOfNode(self, v)
getPartition(self)
numberOfComponents(self)
run(self)
class networkit.components.StronglyConnectedComponents

Bases: object

Determines the connected components and associated values for a directed graph.

By default, the iterative implementation is used. If edges on the graph have been removed, you should switch to the recursive implementation.

G : Graph
The graph.
iterativeAlgo : boolean
Specifies which implementation to use, by default True for the iterative implementation.
componentOfNode(self, v)
getPartition(self)
numberOfComponents(self)
run(self)
runIteratively(self)
runRecursively(self)
class networkit.components.WeaklyConnectedComponents

Bases: object

Determines the weakly connected components of a directed graph.

G : Graph
The graph.
componentOfNode(self, v)

Returns the the component in which node @a u is.

v : node
The node.
getComponentSizes(self)

Returns the map from component to size.

Returns map[index, count]

A map that maps each component to its size.
getComponents(self)

Returns all the components, each stored as (unordered) set of nodes.

Returns vector[vector[node]]

A vector of vectors. Each inner vector contains all the nodes inside the component.
numberOfComponents(self)

Returns the number of components.

Returns count

The number of components.
run(self)