4.1.9.5. graph/Union¶
- class mod.UnionGraph¶
An adaptor for a multiset of
Graph
s to present them as their disjoint union.It functions as an iterable of the adapted graphs, and it implements the
protocols.LabelledGraph
protocol.- __init__()¶
- __init__(graphs)
Construct a graph representing the disjoint union of
graphs
. Thus, if no graphs are given the empty graph is constructed.- Parameters:
- Raises:
LogicError – if a given graph is
None
.
- __iter__()¶
- Returns:
the range of graphs adapted by this object.
- __getitem__(i)¶
- Returns:
the
i
th adapted graph.- Return type:
- Raises:
LogicError
ifi
is out of range.
- printTermState()¶
Print the term state for the graph.
- class Vertex¶
Implements the
protocols.LabelledGraph.Vertex
protocol. Additionally, theid
is in the range \([0, numVertices[\).A non-null vertex represents a specific
Graph.Vertex
. As the sameGraph
can be part of aUnionGraph
multiple times, a vertex also has a graph index to determine which instance of aGraph
in theUnionGraph
the vertex refers to.- graphIndex¶
(Read-only) The index of the graph in the owning
UnionGraph
this vertex is from. The index is thus in the range \([0, len(graph)[\).We can obtain the underlying
Graph
this vertex,self
, is from both directly via thevertex
attribute asself.vertex.graph
, or via the graph index asself.graph[self.graphIndex]
.- Type:
- Raises:
LogicError
if it is a null vertex.
- vertex¶
(Read-only) The underlying
Graph.Vertex
this vertex represents.We can obtain the underlying
Graph
this vertex,self
, is from both directly via thevertex
attribute asself.vertex.graph
, or via the graph index asself.graph[self.graphIndex]
.- Type:
- Raises:
LogicError
if it is a null vertex.
- class Edge¶
Implements the
protocols.LabelledGraph.Vertex
protocol.A non-null edge represents a specific
Graph.Edge
. As the sameGraph
can be part of aUnionGraph
multiple times, an edge also has a graph index to determine which instance of aGraph
in theUnionGraph
the edge refers to.- graphIndex¶
(Read-only) The index of the graph in the owning
UnionGraph
this edge is from. The index is thus in the range \([0, len(graph)[\).We can obtain the underlying
Graph
this edge,self
, is from both directly via theedge
attribute asself.edge.graph
, or via the graph index asself.graph[self.graphIndex]
.- Type:
- Raises:
LogicError
if it is a null edge.
- edge¶
(Read-only) The underlying
Graph.Edge
this edge represents.We can obtain the underlying
Graph
this edge,self
, is from both directly via theedge
attribute asself.edge.graph
, or via the graph index asself.graph[self.graphIndex]
.- Type:
- Raises:
LogicError
if it is a null edge.
- class VertexRange¶
Implements the
protocols.Graph.VertexRange
protocol, in addition to the following functionality.- __getitem__(i)¶
- Returns:
the
i
th vertex of the graph.- Return type:
- class EdgeRange¶
Implements the
protocols.Graph.EdgeRange
protocol.
- class IncidentEdgeRange¶
Implements the
protocols.Graph.IncidentEdgeRange
protocol.
- class mod.VertexMapUnionGraphUnionGraph¶
Implements the
protocols.VertexMap
protocol.