Landmark.isneighbor#

Landmark.isneighbor(vertex: Vertex) → bool#

Test if a vertex is adjacent to this vertex

Parameters:

vertex (Vertex subclass) – vertex reference

Returns:

true if vertex is adjacent

Return type:

bool

For a directed graph this is true only if there is an edge from self to vertex.

isneighbour and isneighbor are aliases.

>>> from pgraph import UGraph
>>> g = UGraph()
>>> v1 = g.add_vertex(coord=[0,0], name='v1')
>>> v2 = g.add_vertex(coord=[1,1], name='v2')
>>> v3 = g.add_vertex(coord=[2,2], name='v3')
>>> g.add_edge(v1, v2)
Edge{[v1] -- [v2], cost=1.414}
>>> print(v1.isadjacent(v2))
True
>>> print(v1.isadjacent(v3))
False
Seealso:

adjacent