Observation.next#

Observation.next(vertex: Vertex) → Vertex#

Return other end of an edge

Parameters:

vertex (Vertex subclass) – one vertex on the edge

Raises:

ValueError – vertex is not on the edge

Returns:

the other vertex on the edge

Return type:

Vertex subclass

e.next(v1) is the vertex at the other end of edge e, ie. the vertex that is not v1.

>>> from pgraph import Vertex, Edge
>>> v1 = Vertex(coord=[1,2], name="A")
>>> v2 = Vertex(coord=[3,4], name="B")
>>> e = Edge(v1, v2, cost=5.0, data="A to B")
>>> print(e)
Edge{[A] -- [B], cost=5} data=A to B
>>> e.next(v1)
Vertex[B, coord=(3, 4)]
>>> e.next(v2)
Vertex[A, coord=(1, 2)]