用法
graph_center(graph, ..., weights = NULL, mode = c("all", "out", "in", "total"))
参见
其他路径:all_simple_paths()
, diameter()
, distance_table()
, eccentricity()
, radius()
示例
tree <- make_tree(100, 7)
graph_center(tree)
#> + 2/100 vertices, from 68e1f9b:
#> [1] 1 2
graph_center(tree, mode = "in")
#> + 1/100 vertex, from 68e1f9b:
#> [1] 1
graph_center(tree, mode = "out")
#> + 85/100 vertices, from 68e1f9b:
#> [1] 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#> [20] 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#> [39] 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#> [58] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#> [77] 92 93 94 95 96 97 98 99 100
# Without and with weights
ring <- make_ring(10)
graph_center(ring)
#> + 10/10 vertices, from 2f6cc06:
#> [1] 1 2 3 4 5 6 7 8 9 10
# Add weights
E(ring)$weight <- seq_len(ecount(ring))
graph_center(ring)
#> + 1/10 vertex, from 2f6cc06:
#> [1] 7