顶点的顺序仅在有向图中重要,因为在有向图中查询的是是否存在有向边 (v1, v2)
。
参见
其他结构查询:[.igraph()
、[[.igraph()
、adjacent_vertices()
、ends()
、get_edge_ids()
、gorder()
、gsize()
、head_of()
、incident()
、incident_edges()
、is_directed()
、neighbors()
、tail_of()
示例
ug <- make_ring(10)
ug
#> IGRAPH 271f151 U--- 10 10 -- Ring graph
#> + attr: name (g/c), mutual (g/l), circular (g/l)
#> + edges from 271f151:
#> [1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10
are_adjacent(ug, 1, 2)
#> [1] TRUE
are_adjacent(ug, 2, 1)
#> [1] TRUE
dg <- make_ring(10, directed = TRUE)
dg
#> IGRAPH 1e4ae85 D--- 10 10 -- Ring graph
#> + attr: name (g/c), mutual (g/l), circular (g/l)
#> + edges from 1e4ae85:
#> [1] 1-> 2 2-> 3 3-> 4 4-> 5 5-> 6 6-> 7 7-> 8 8-> 9 9->10 10-> 1
are_adjacent(ug, 1, 2)
#> [1] TRUE
are_adjacent(ug, 2, 1)
#> [1] TRUE