edgegraph.structure.twoendedlink.TwoEndedLink#
- class edgegraph.structure.twoendedlink.TwoEndedLink(v1=None, v2=None, *, uid=None, attributes=None)#
Bases:
LinkRepresents an two-ended edge (v1 and v2) in the vertex-edge graph. It is neither undirected nor directed, and not intended for explicit use.
See also
You may want one of these subclasses of links, which are intended for explicit use:
- __init__(v1=None, v2=None, *, uid=None, attributes=None)#
Instantiate an two-ended edge.
- Parameters:
See also
edgegraph.structure.link.Link.__init__(), the superclass constructor
Methods
__init__([v1, v2, uid, attributes])Instantiate an two-ended edge.
add_to_universe(universe)Adds this object to a new universe.
add_vertex(new)Adds a vertex to this link.
other(end)Identify and return the other end of this edge.
remove_from_universe(universe)Remove this object from the specified universe.
unlink_from(kill)Remove the link association from the given vertex.
Attributes
Get the UID of this object.
Get the universes this object belongs to.
Return one vertex of this edge.
Return the other vertex of this edge.
Return a tuple of vertices this edge connects.
- add_to_universe(universe)#
Adds this object to a new universe. If it is already there, no action is taken.
- Parameters:
universe (Universe) – the new universe to add this object to
- add_vertex(new)#
Adds a vertex to this link.
- Parameters:
new (Vertex) – the vertex to add to the link
- other(end)#
Identify and return the other end of this edge.
This is mainly a convience method – it accepts one vertex as an argument, figures out whether it’s v1 or v2 of this edge, and returns v2 or v1 respectively.
Should the given vertex not be a part of this edge,
Noneis returned.
- remove_from_universe(universe)#
Remove this object from the specified universe.
- property universes: frozenset[Universe]#
Get the universes this object belongs to.
Note that this gives you a
frozenset; you cannot add or remove universes from this attribute.See also
add_to_universe(),remove_from_universe()to add or remove this object from a given universe
- unlink_from(kill)#
Remove the link association from the given vertex.
This is effectively “unlinking” the specified vertex from this link. If this link is not associated with the given vertex, no action is taken.
- Parameters:
kill (Vertex) – the vertex to unlink
- property v1: Vertex#
Return one vertex of this edge.
Setting this attribute automatically handles link-vertex assocation updates; no extra effort is necessary.