components {sna} | R Documentation |
Returns the number of components within dat
, using the connectedness rule given in connected
.
components(dat, connected="strong", comp.dist.precomp=NULL)
dat |
one or more input graphs. |
connected |
the symmetrizing rule to be used by symmetrize before components are extracted |
comp.dist.precomp |
a component size distribution object from component.dist (optional) |
The connected
parameter corresponds to the rule
parameter of component.dist
. By default, components
returns the number of strong components, but weak components can be returned if so desired. For symmetric matrices, this is obviously a moot point.
A vector containing the number of components for each graph in dat
Carter T. Butts buttsc@uci.edu
West, D.B. (1996). Introduction to Graph Theory. Upper Saddle River, NJ: Prentice Hall.
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")