# component.size.byvertex: Get Component Sizes, by Vertex In sna: Tools for Social Network Analysis

## Description

This function computes the component structure of the input network, and returns a vector whose ith entry is the size of the component to which i belongs. This is useful e.g. for studies of diffusion or similar applications.

## Usage

 ```1 2``` ```component.size.byvertex(dat, connected = c("strong", "weak", "unilateral", "recursive")) ```

## Arguments

 `dat` one or more input graphs (for best performance, sna edgelists or network objects are suggested). `connected` a string selecting the connectedness definition to use; by default, `"strong"` components are used.

## Details

Component sizes are here computed using `component.dist`; see this function for additional information.

In an undirected graph, the size of v's component represents the maximum number of nodes that can be reached by a diffusion process along the edges of the graph originating with node v; the expectation of component sizes by vertex (rather than the mean component size) is thus one measure of the maximum average diffusion potential of a graph. Because this quantity is monotone with respect to edge addition, it can be bounded using Bernoulli graphs (see Butts (2011)). In the directed case, multiple types of components are possible; see `component.dist` for details.

## Value

A vector of length equal to the number of vertices in `dat`, whose ith element is the number of vertices in the component to which the ith vertex belongs.

## Author(s)

Carter T. Butts [email protected]

## References

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

Butts, C.T. (2011). “Bernoulli Bounds for General Random Graphs.” Sociological Methodology, 41, 299-345.

`component.dist`
 ```1 2 3 4 5 6``` ```#Generate a random undirected graph g<-rgraph(100,tprob=1.5/99,mode="graph",return.as.edgelist=TRUE) #Get the component sizes for each vertex cs<-component.size.byvertex(g) cs ```