Skip to contents

Basic Properties

Usage

are_adjacent(graph, from, to)

Arguments

graph

An igraph_ptr object.

from

An integer vector of vertex IDs.

to

An integer vector of vertex IDs.

Value

A logical, TRUE if from and to are adjacent, FALSE otherwise.

See also

edge(), neighbors(), incident() for similar operations. as_adjlist() and degree() can apply to all vertices at once.

Examples

g = graph_tree(5L)
are_adjacent(g, 1L, 2L)
#> [1] TRUE
are_adjacent(g, 1L, 4L)
#> [1] FALSE