Skip to content

Commit 06b3ab4

Browse files
petercorkeclaude
andcommitted
docs: Edge.connect warns against re-connecting an edge already in a graph
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 1ebc41b commit 06b3ab4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/pgraph/PGraph.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,9 +2383,12 @@ def connect(self, v1: BaseVertex, v2: BaseVertex) -> None:
23832383
the vertices belong to different graphs
23842384
23852385
The edge connects vertices ``v1`` and ``v2``, and is added to the
2386-
graph that those vertices belong to. The edge's ``v1`` and ``v2`` are
2387-
overwritten, so this can be used to re-point an edge object that was
2388-
built with other vertices.
2386+
graph that those vertices belong to.
2387+
2388+
.. warning:: Intended for an edge that is not yet part of a graph. The
2389+
edge's ``v1`` and ``v2`` are overwritten without checking, so
2390+
connecting an edge that is already in a graph leaves it
2391+
referenced from its old vertices as well.
23892392
23902393
.. runblock:: pycon
23912394

0 commit comments

Comments
 (0)