component.dist {sna} | R Documentation |
component.dist
returns a data frame containing a vector of length n such that the ith element contains the number of components of G having size i, and a vector of length n giving component membership. Component strength is determined by the rule used to symmetrize the adjacency matrix; this is controlled by the eponymous parameter given to the symmetrize
command.
component.dist(dat, connected="strong")
dat |
A single nxn adjacency matrix |
connected |
A string corresponding to the rule parameter of the symmetrize command; by default, ``strong'' components are used. |
Use ``strong'' to find strongly connected components, ``weak'' for weakly connected components, etc. If dat
is already symmetric, then the connected
parameter has no effect.
A data frame containing:
membership |
A vector of component memberships, by vertex |
csize |
A vector of component sizes, by component |
cdist |
A vector of length |V(G)| with the (unnormalized) empirical distribution function of component sizes |
Carter T. Butts ctb@andrew.cmu.edu
West, D.B. (1996). Introduction to Graph Theory. Upper Saddle River, N.J.: Prentice Hall.
components
, symmetrize
, geodist
g<-rgraph(20,tprob=0.075) #Generate a sparse random graph #Find weak components cd<-component.dist(g,connected="weak") cd$membership #Who's in what component? cd$csize #What are the component sizes? #Plot the size distribution plot(1:length(cd$cdist),cd$cdist/sum(cd$cdist),ylim=c(0,1),type="h") #Find strong components cd<-component.dist(g,connected="strong") cd$membership #Who's in what component? cd$csize #What are the component sizes? #Plot the size distribution plot(1:length(cd$cdist),cd$cdist/sum(cd$cdist),ylim=c(0,1),type="h")