ntcmp
Connected components
ntcmp(from, to, nodes = NULL, dir = FALSE)Weak components join nodes linked by edges in either direction; strong
components (Tarjan’s algorithm, without recursion) join nodes that
reach each other along the edges’ directions. Undirected, the two
coincide. Components are numbered 1, 2, … in the order of their first
node. Graph rules as in ntdeg().
Parameters
Section titled “Parameters”from, toLabels of the two ends of each edge: vectors of the same length (zero when
nodesgives every node) with no missing values.nodesNULL, or every node’s label once: the node order of the results and the way to include isolated nodes.dirTRUEfor a directed graph (fromsends a tie toto).
Returns
Section titled “Returns”A data frame: node, weak, strong.
References
Section titled “References”Tarjan, R. (1972). Depth-first search and linear graph algorithms. SIAM Journal on Computing, 1(2), 146-160. doi:10.1137/0201010
Examples
Section titled “Examples”ntcmp(c("a", "b", "c", "x"), c("b", "c", "a", "y"), dir = TRUE)Generated from the R help page: ntcmp in the R reference.