components: Find the Number of (Maximal) Components Within a Given Graph

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Returns the number of components within dat, using the connectedness rule given in connected.

Usage

1
components(dat, connected="strong", comp.dist.precomp=NULL)

Arguments

dat

one or more input graphs.

connected

the the component definition to be used by component.dist during component extraction.

comp.dist.precomp

a component size distribution object from component.dist (optional).

Details

The connected parameter corresponds to the rule parameter of component.dist. By default, components returns the number of strong components, but other component types can be returned if so desired. (See component.dist for details.) For symmetric matrices, this is obviously a moot point.

Value

A vector containing the number of components for each graph in dat

Author(s)

Carter T. Butts buttsc@uci.edu

References

West, D.B. (1996). Introduction to Graph Theory. Upper Saddle River, NJ: Prentice Hall.

See Also

component.dist, symmetrize

Examples

1
2
3
4
5
6
7
g<-rgraph(20,tprob=0.05)   #Generate a sparse random graph

#Find weak components
components(g,connected="weak")

#Find strong components
components(g,connected="strong")


Search within the sna package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.