Description Usage Arguments Details Value Author(s) Examples

View source: R/structural.properties.R

These functions find the vertices not farther than a given limit from another fixed vertex, these are called the neighborhood of the vertex.

1 2 3 4 5 6 7 8 |

`graph` |
The input graph. |

`order` |
Integer giving the order of the neighborhood. |

`nodes` |
The vertices for which the calculation is performed. |

`mode` |
Character constant, it specifies how to use the direction of
the edges if a directed graph is analyzed. For ‘out’ only the
outgoing edges are followed, so all vertices reachable from the source
vertex in at most |

`mindist` |
The minimum distance to include the vertex in the result. |

The neighborhood of a given order `o`

of a vertex `v`

includes all
vertices which are closer to `v`

than the order. Ie. order 0 is always
`v`

itself, order 1 is `v`

plus its immediate neighbors, order 2
is order 1 plus the immediate neighbors of the vertices in order 1, etc.

`ego_size`

calculates the size of the neighborhoods for the
given vertices with the given order.

`ego`

calculates the neighborhoods of the given vertices with
the given order parameter.

`make_ego_graph`

is creates (sub)graphs from all neighborhoods of
the given vertices with the given order parameter. This function preserves
the vertex, edge and graph attributes.

`connect`

creates a new graph by connecting each vertex to
all other vertices in its neighborhood.

`ego_size`

returns with an integer vector.

`ego`

returns with a list of integer vectors.

`make_ego_graph`

returns with a list of graphs.

`connect`

returns with a new graph object.

Gabor Csardi [email protected], the first version was done by Vincent Matossian

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
g <- make_ring(10)
ego_size(g, order = 0, 1:3)
ego_size(g, order = 1, 1:3)
ego_size(g, order = 2, 1:3)
ego(g, order = 0, 1:3)
ego(g, order = 1, 1:3)
ego(g, order = 2, 1:3)
# attributes are preserved
V(g)$name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")
make_ego_graph(g, order = 2, 1:3)
# connecting to the neighborhood
g <- make_ring(10)
g <- connect(g, 2)
``` |

igraph documentation built on July 28, 2018, 1:01 a.m.

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.