Landmark.copy#

Landmark.copy(cls: type[Graph] | None = None) → Vertex#

Copy a vertex

Parameters:

cls (UGraph or DGraph subclass, optional) – graph class whose vertex_copy method should be used to create the copy, defaults to None

Returns:

a new, unconnected vertex with the same coordinate and name

Return type:

Vertex subclass

If cls is given, cls.vertex_copy(self) is used to create a vertex of the appropriate subclass for that graph type, otherwise a vertex of the same class as self is created directly.

>>> from pgraph import Vertex, DGraph
>>> v = Vertex(coord=[1,2], name='v1')
>>> v2 = v.copy(cls=DGraph)
>>> print(v2)
[v1]
Seealso:

Graph.vertex_copy