The order of the vertices only matters in directed graphs,
where the existence of a directed (v1, v2)
edge is queried.
Arguments
- graph
The graph.
- v1
The first vertex, tail in directed graphs.
- v2
The second vertex, head in directed graphs.
See also
Other structural queries:
[.igraph()
,
[[.igraph()
,
adjacent_vertices()
,
ends()
,
get.edge.ids()
,
gorder()
,
gsize()
,
head_of()
,
incident()
,
incident_edges()
,
is_directed()
,
neighbors()
,
tail_of()
Examples
ug <- make_ring(10)
ug
#> IGRAPH f40fac3 U--- 10 10 -- Ring graph
#> + attr: name (g/c), mutual (g/l), circular (g/l)
#> + edges from f40fac3:
#> [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 265a7c9 D--- 10 10 -- Ring graph
#> + attr: name (g/c), mutual (g/l), circular (g/l)
#> + edges from 265a7c9:
#> [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