Pebble Digraph¶
Auxiliary class for directed graph used in pebble game style algorithms.
- class pyrigi.graph._sparsity._pebble_digraph.PebbleDiGraph(K=None, L=None, *args, **kwargs)[source]¶
Bases:
MultiDiGraphClass representing a directed graph for pebble game algorithm.
It must hold that
0 < KandL < 2K.Notes
All
networkxmethods in use need a wrapper - to make future developments easier.- _input_check_vertex_member(to_check)[source]¶
Check whether a given element is indeed a vertex and raise an error otherwise.
- Return type:
- Parameters:
to_check (:type:`~pyrigi.data_type.Vertex`)
- add_edge_maintaining_digraph(u, v)[source]¶
Add the given edge to the pebble digraph, if possible.
Add an edge to the pebble digraph if it is possible and choose the correct orientation. This also checks the possibility of adding the edge and return
TrueorFalsedepending on it.- Return type:
- Parameters:
u (:type:`~pyrigi.data_type.Vertex`)
v (:type:`~pyrigi.data_type.Vertex`)
- add_edges_maintaining_digraph(edges)[source]¶
Run
add_edge_maintaining_digraphfor each edge in the list.Note that this might not add all the edges, only the edges that take part of the maximal sparse subgraph.
- can_add_edge_between_vertices(u, v)[source]¶
Check whether the edge
(u, v)can be added to the pebble digraph.- Return type:
- Parameters:
u (:type:`~pyrigi.data_type.Vertex`)
v (:type:`~pyrigi.data_type.Vertex`)
- fundamental_circuit(u, v)[source]¶
Return the fundamental \((k, l)\)-matroid circuit of the edge
uv.If the edge
uvis independent,Noneis returned.- Return type:
{set[MyTypeAliasForwardRef(’
Vertex’)]}- Parameters:
u (:type:`~pyrigi.data_type.Vertex`)
v (:type:`~pyrigi.data_type.Vertex`)
- in_degree(vertex)[source]¶
Return the number of edges leading to
vertex.- Return type:
- Parameters:
vertex (:type:`~pyrigi.data_type.Vertex`)
- out_degree(vertex)[source]¶
Return the number of edges leading out from
vertex.- Return type:
- Parameters:
vertex (:type:`~pyrigi.data_type.Vertex`)
- redirect_edge_to_head(edge, vertex_to)[source]¶
Redirect given edge to the given head.
- Parameters:
edge (
DirectedEdge) – A directed edge to redirect.vertex_to (
Vertex) – A vertex to which the edge should point to. The vertex must be part of the edge.
- Return type: