concom | R Documentation |
Fast computation of the connected components of an undirected graph.
concom(edges)
edges |
a matrix with two columns, whose rows represent the edges of the graph; each edge is given by two vertex indices, and it is assumed that the vertex indices are 1, 2, 3, ... |
A list with four elements: indices
, an integer vector
whose i
-th element gives the label of the connected component of
vertex i
; sizes
, an integer vector giving the number of
elements of each connected component; ncomponents
, the number
of connected components; components
, a list of length
ncomponents
, whose j
-th element is the integer vector made
of the labels of the j
-th connected component.
library(concom) edges <- cbind( 1:7, c(2, 3, 1, 5, 6, 7, 4) ) concom(edges)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.