-
Notifications
You must be signed in to change notification settings - Fork 8
Under the hood
Peter Corke edited this page Jun 26, 2021
·
3 revisions
The graph has:
-
_vertexlist
a list of all vertices have a back reference in order of addition -
_vertexdict
a dictionary of all vertices indexed by name -
_edgelist
a list of all edges
Every vertex has:
-
coord
the coordinate of the vertex if the graph is embedded -
_edgelist
a list of all edges starting at this vertex. For an undirected graph this is all edges, for a directed graph this is all edges leaving this vertex -
name
a unique name, if not given a name of the form#N
is given whereN
is the index of the vertex in the graph's_vertexlist
- a back reference to its owning graph which is set when the vertex is added to the graph by
add_vertex
. This means a vertex can only be in one graph.
Every edge has:
- a reference to the vertices which are its endpoints
-
cost
which is the cost of traversing the edge -
data
which is a reference to arbitrary user data associated with the edge. A more general approach is to subclassEdge
.
The key objects and their interactions are shown below.