Calculate the maximal (weakly or strongly) connected components of a graph
The graph to analyze.
Logical, if TRUE the cumulative distirubution (relative frequency) is calculated.
Logical. If TRUE the relative frequencies will be multiplied by the cluster sizes.
Additional attributes to pass to
cluster, right now only
Character string, either “weak” or “strong”. For directed graphs “weak” implies weakly, “strong” strongly connected components to search. It is ignored for undirected graphs.
is_connected() a logical constant.
components() a named list with three components:
numeric vector giving the cluster id to which each vertex belongs.
numeric vector giving the sizes of the clusters.
numeric constant, the number of clusters.
count_components() an integer constant is returned.
component_distribution() a numeric vector with the relative
frequencies. The length of the vector is the size of the largest component
plus one. Note that (for currently unknown reasons) the first element of the
vector is the number of clusters of size zero, so this is always zero.
largest_component() the largest connected component of the graph.
is_connected() decides whether the graph is weakly or strongly
connected. The null graph is considered disconnected.
components() finds the maximal (weakly or strongly) connected components
of a graph.
count_components() does almost the same as
components() but returns only
the number of clusters found instead of returning the actual clusters.
component_distribution() creates a histogram for the maximal connected
largest_component() returns the largest connected component of a graph. For
directed graphs, optionally the largest weakly or strongly connected component.
In case of a tie, the first component by vertex ID order is returned. Vertex
IDs from the original graph are not retained in the returned graph.
The weakly connected components are found by a simple breadth-first search. The strongly connected components are implemented by two consecutive depth-first searches.
Gabor Csardi firstname.lastname@example.org
g <- sample_gnp(20, 1 / 20) clu <- components(g) groups(clu) #> $`1` #>  1 2 5 7 9 11 17 19 #> #> $`2` #>  3 14 #> #> $`3` #>  4 8 10 #> #> $`4` #>  6 #> #> $`5` #>  12 #> #> $`6` #>  13 #> #> $`7` #>  15 #> #> $`8` #>  16 #> #> $`9` #>  18 #> #> $`10` #>  20 #> largest_component(g) #> IGRAPH 7ba862c U--- 8 8 -- Erdos-Renyi (gnp) graph #> + attr: name (g/c), type (g/c), loops (g/l), p (g/n) #> + edges from 7ba862c: #>  1--3 2--3 2--5 3--6 3--7 4--7 3--8 5--8