graph_center: Central vertices of a graph

graph_centerR Documentation

Central vertices of a graph

Description

[Experimental]

The center of a graph is the set of its vertices with minimal eccentricity.

Usage

graph_center(graph, ..., weights = NULL, mode = c("all", "out", "in", "total"))

Arguments

graph

The input graph, it can be directed or undirected.

...

These dots are for future extensions and must be empty.

weights

Possibly a numeric vector giving edge weights. If this is NULL and the graph has a weight edge attribute, then the attribute is used. If this is NA then no weights are used (even if the graph has a weight attribute). In a weighted graph, the length of a path is the sum of the weights of its constituent edges.

mode

Character constant, gives whether the shortest paths to or from the given vertices should be calculated for directed graphs. If out then the shortest paths from the vertex, if ⁠in⁠ then to it will be considered. If all, the default, then the graph is treated as undirected, i.e. edge directions are not taken into account. This argument is ignored for undirected graphs.

Value

The vertex IDs of the central vertices.

See Also

eccentricity(), radius()

Other paths: all_simple_paths(), diameter(), distance_table(), eccentricity(), radius()

Examples

tree <- make_tree(100, 7)
graph_center(tree)
graph_center(tree, mode = "in")
graph_center(tree, mode = "out")

# Without and with weights
ring <- make_ring(10)
graph_center(ring)
# Add weights
E(ring)$weight <- seq_len(ecount(ring))
graph_center(ring)


igraph/rigraph documentation built on May 19, 2024, 6:19 a.m.