4.1.11.5. graph/Union¶
- class mod.UnionGraph¶
An adaptor for a multiset of
Graphs to present them as their disjoint union.It functions as an iterable of the adapted graphs, and it implements the
protocols.LabelledGraphprotocol.- __init__()¶
- __init__(graphs)
Construct a graph representing the disjoint union of
graphs. Thus, if no graphs are given the empty graph is constructed.
- __iter__()¶
- Returns
the range of graphs adapted by this object.
- __getitem__(i)¶
- Returns
the
ith adapted graph.- Return type
- Raises
LogicErrorifiis out of range.
- class Vertex¶
Implements the
protocols.LabelledGraph.Vertexprotocol. Additionally, theidis in the range \([0, numVertices[\).A non-null vertex represents a specific
Graph.Vertex. As the sameGraphcan be part of aUnionGraphmultiple times, a vertex also has a graph index to determine which instance of aGraphin theUnionGraphthe vertex refers to.- graphIndex¶
(Read-only) The index of the graph in the owning
UnionGraphthis vertex is from. The index is thus in the range \([0, len(graph)[\).We can obtain the underlying
Graphthis vertex,self, is from both directly via thevertexattribute asself.vertex.graph, or via the graph index asself.graph[self.graphIndex].- Type
- Raises
LogicErrorif it is a null vertex.
- vertex¶
(Read-only) The underlying
Graph.Vertexthis vertex represents.We can obtain the underlying
Graphthis vertex,self, is from both directly via thevertexattribute asself.vertex.graph, or via the graph index asself.graph[self.graphIndex].- Type
- Raises
LogicErrorif it is a null vertex.
- class Edge¶
Implements the
protocols.LabelledGraph.Vertexprotocol.A non-null edge represents a specific
Graph.Edge. As the sameGraphcan be part of aUnionGraphmultiple times, an edge also has a graph index to determine which instance of aGraphin theUnionGraphthe edge refers to.- graphIndex¶
(Read-only) The index of the graph in the owning
UnionGraphthis edge is from. The index is thus in the range \([0, len(graph)[\).We can obtain the underlying
Graphthis edge,self, is from both directly via theedgeattribute asself.edge.graph, or via the graph index asself.graph[self.graphIndex].- Type
- Raises
LogicErrorif it is a null edge.
- edge¶
(Read-only) The underlying
Graph.Edgethis edge represents.We can obtain the underlying
Graphthis edge,self, is from both directly via theedgeattribute asself.edge.graph, or via the graph index asself.graph[self.graphIndex].- Type
- Raises
LogicErrorif it is a null edge.
- class VertexRange¶
Implements the
protocols.Graph.VertexRangeprotocol, in addition to the following functionality.- __getitem__(i)¶
- Returns
the
ith vertex of the graph.- Return type
- class EdgeRange¶
Implements the
protocols.Graph.EdgeRangeprotocol.
- class IncidentEdgeRange¶
Implements the
protocols.Graph.IncidentEdgeRangeprotocol.
- class mod.VertexMapUnionGraphUnionGraph¶
Implements the
protocols.VertexMapprotocol.