3.1. igraph_neighborhood_size — Calculates the size of the neighborhood of a given vertex

int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res,
			     igraph_vs_t vids, igraph_integer_t order,
			     igraph_neimode_t mode);

The neighborhood of a given order of a vertex includes all vertices which are closer to the vertex than the order. Ie. order 0 is always the vertex itself, order 1 is the vertex plus its immediate neighbors, order 2 is order 1 plus the immediate neighbors of the vertices in order 1, etc.

This function calculates the size of the neighborhood of the given order for the given vertices.

Arguments: 

graph:

The input graph.

res:

Pointer to an initialized vector, the result will be stored here. It will be resized as needed.

vids:

The vertices for which the calculation is performed.

order:

Integer giving the order of the neighborhood.

mode:

Specifies how to use the direction of the edges if a directed graph is analyzed. For IGRAPH_OUT only the outgoing edges are followed, so all vertices reachable from the source vertex in at most order steps are counted. For IGRAPH_IN all vertices from which the source vertex is reachable in at most order steps are counted. IGRAPH_ALL ignores the direction of the edges. This argument is ignored for undirected graphs.

Returns: 

Error code.

See also: 

igraph_neighborhood() for calculating the actual neighborhood, igraph_neighborhood_graphs() for creating separate graphs from the neighborhoods.

Time complexity: O(n*d*o), where n is the number vertices for which the calculation is performed, d is the average degree, o is the order.