@@ -2379,9 +2379,13 @@ def connect(self, v1: BaseVertex, v2: BaseVertex) -> None:
23792379 :type v1: BaseVertex subclass
23802380 :param v2: end of the edge
23812381 :type v2: BaseVertex subclass
2382+ :raises ValueError: either vertex has not been added to a graph, or
2383+ the vertices belong to different graphs
23822384
23832385 The edge connects vertices ``v1`` and ``v2``, and is added to the
2384- graph that those vertices belong to.
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.
23852389
23862390 .. runblock:: pycon
23872391
@@ -3132,12 +3136,19 @@ def connect(
31323136 :param data: reference to arbitrary data associated with the edge,
31333137 defaults to None
31343138 :type data: Any, optional
3139+ :raises ValueError: either vertex has not been added to a graph, the
3140+ vertices belong to different graphs, or ``edge`` already connects
3141+ other vertices
31353142 :return: the edge connecting the vertices
31363143 :rtype: Edge
31373144
31383145 Unlike the directed-graph counterpart, the new edge is added to
31393146 *both* vertices' edge lists, so it is discovered from either end.
31403147
3148+ If ``edge`` was built without vertices its ``v1`` and ``v2`` are set
3149+ to ``self`` and ``dest``. If it was built with vertices they must be
3150+ these two, in either order since an undirected edge has no direction.
3151+
31413152 .. runblock:: pycon
31423153
31433154 >>> from pgraph import UVertex, Edge, UGraph
@@ -3201,13 +3212,20 @@ def connect(
32013212 :param data: reference to arbitrary data associated with the edge,
32023213 defaults to None
32033214 :type data: Any, optional
3215+ :raises ValueError: either vertex has not been added to a graph, the
3216+ vertices belong to different graphs, or ``edge`` already connects
3217+ other vertices
32043218 :return: the edge connecting the vertices
32053219 :rtype: Edge
32063220
32073221 Unlike the undirected-graph counterpart, the new edge is added only
32083222 to *this* vertex's edge list -- it is only discoverable from the
32093223 start of the directed edge.
32103224
3225+ If ``edge`` was built without vertices its ``v1`` and ``v2`` are set
3226+ to ``self`` and ``dest``. If it was built with vertices they must be
3227+ exactly these two, in this order, since the edge has a direction.
3228+
32113229 .. runblock:: pycon
32123230
32133231 >>> from pgraph import DVertex, Edge, DGraph
0 commit comments