Skip to main content
Ctrl+K
edgegraph is in unstable version v0.10, and may change at any time!
this documentation was built on branch feature/generator-neighbors!

edgegraph 0.10.0 documentation

Contents:

  • EdgeGraph
  • edgegraph usage
    • Installation
    • Concept
    • Program diagrams
    • API documentation
      • edgegraph
        • edgegraph.builder
        • edgegraph.output
        • edgegraph.structure
        • edgegraph.traversal
        • edgegraph.version
    • Performance and optimizing
  • Developer documentation
    • Development Practices
    • Testing Practices
      • tests
        • tests.builder
        • tests.conftest
        • tests.fixtures
        • tests.integration
        • tests.interact
        • tests.output
        • tests.structure
        • tests.test_version
        • tests.traversal
    • Documentation practices
    • To-Do’s
  • References
  • Repository
  • Show source
  • Suggest edit
  • Open issue
  • .rst

edgegraph.structure.link.Link

Contents

  • Link
    • Link.__init__()
    • Link.add_to_universe()
    • Link.add_vertex()
    • Link.remove_from_universe()
    • Link.uid
    • Link.universes
    • Link.unlink_from()
    • Link.vertices

edgegraph.structure.link.Link#

class edgegraph.structure.link.Link(*, vertices=None, uid=None, attributes=None, _force_creation=False)#

Bases: BaseObject

Represents an edge in the edge-vertex graph.

Warning

This object is the base class for edge types, and should not be used on its own. Its meaning and semantics are undefined (it is neither a directed edge nor an undirected edge).

See also

  • UnDirectedEdge, a subclass representing an undirected edge between two vertices

  • DirectedEdge, a subclass representing a directed edge between two vertices

__init__(*, vertices=None, uid=None, attributes=None, _force_creation=False)#

Instantiate a new link (“edge”).

Warning

Generally, creating objects of this type is a bad idea, as their meaning is undefined. Instead, see the subclass types that implement directed or undirected edges.

Parameters:
  • vertices (list[Vertex] | None) – list of Vertex objects that this link links

  • _force_creation (bool | None) – force the instantiation of this object without error

See also

  • edgegraph.structure.base.BaseObject.__init__(), the superclass constructor

Methods

__init__(*[, vertices, uid, attributes, ...])

Instantiate a new link ("edge").

add_to_universe(universe)

Adds this object to a new universe.

add_vertex(new)

Adds a vertex to this link.

remove_from_universe(universe)

Remove this object from the specified universe.

unlink_from(kill)

Remove the link association from the given vertex.

Attributes

uid

Get the UID of this object.

universes

Get the universes this object belongs to.

vertices

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

remove_from_universe(universe)#

Remove this object from the specified universe.

Parameters:

universe (Universe) – the universe that this object will be removed from

Raises:

ValueError – if this object is not present in the given universe

property uid: int#

Get the UID of this object.

property universes: list[Universe]#

Get the universes this object belongs to.

Note that the copy returned is just that, a copy. Modifications to this list that you may make will have no effect on the object.

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 vertices: tuple[Vertex, ...]#

Return a tuple of vertices this edge connects.

A tuple object is given because the addition or removal of vertex objects using this attribute is not intended; it is meant to be immutable.

previous

edgegraph.structure.link

next

edgegraph.structure.singleton

Contents
  • Link
    • Link.__init__()
    • Link.add_to_universe()
    • Link.add_vertex()
    • Link.remove_from_universe()
    • Link.uid
    • Link.universes
    • Link.unlink_from()
    • Link.vertices

By Misha Turnbull

© Copyright 2023-2025, Michael Turnbull.