graphi.types.decorator module¶
-
graphi.types.decorator.
boundable
(graph_class)¶ Make an implementation of
Graph
bounded when passingvalue_bound
to it@boundable class SomeGraph(abc.Graph): ... unbounded_graph = SomeGraph() bounded_graph = SomeGraph(value_bound=42)
This provides an implementation agnostic interface to ensure all edge values are bounded. For any nodes
a
andb
,graph[a:b] <= value_bound
always holds. Setting an edge value larger thanvalue_bound
removes the edge.
-
graphi.types.decorator.
undirectable
(graph_class)¶ Make an implementation of
Graph
undirected when passingundirected=True
to it@undirectable class SomeGraph(abc.Graph): ... directed_graph = SomeGraph() undirected_graph = SomeGraph(undirected=True)
This provides an implementation agnostic interface to ensure all edges are undirected. For any nodes
a
andb
,graph[a:b] == graph[b:a]
always holds andgraph.edges()
produces only one ofa:b
orb:a
.