Description Usage Arguments Details Value Examples

View source: R/remove_small_components.R

keep only the largest component of graph

1 |

`g` |
An igraph object of the graph to embed. |

As setse only works on connected components this function removes all but the largest component. This is a helper function to quickly project a network with setse.

An igraph object.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
library(igraph)
set.seed(1284)
#generate a random erdos renyi graph with 100 nodes and 150 edges
g <- erdos.renyi.game(n=100, p.or.m = 150, type = "gnm" )
#count the number of components
components(g)$no
#remove all but the largest component
g2 <-remove_small_components(g)
#Now there is only 1 component
igraph::components(g2)$no
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.