Separating Sets¶
This module provides algorithms related to separating sets.
It includes an algorithm for a stable separating set search in a 2-flexible graph according to Algorithm 1 in [CGH+24].
- pyrigi.graph._other.separating_set.is_separating_set(graph, vertices, use_copy=True)[source]¶
Return whether
verticesare a separating set.Definitions
- Parameters:
graph (
Graph)vertices (
Collection[Vertex]) – The vertices to check.use_copy (
bool) – IfTrue(default), create a copy of the graph before the vertices are removed and connectivity is checked. Otherwise, the graph is modified in-place. In that case, some metadata may be lost.
- Return type:
Examples
>>> from pyrigi.graph import Graph >>> import pyrigi.graphDB as graphs >>> H = graphs.Cycle(5) >>> is_separating_set(H, [1,3]) True >>> G = Graph([[0,1],[1,2],[2,3],[2,4],[4,3],[4,5]]) >>> is_separating_set(G, [2]) True >>> is_separating_set(G, [3]) False >>> is_separating_set(G, [3,4]) True
- pyrigi.graph._other.separating_set.is_stable_separating_set(graph, vertices, use_copy=True)[source]¶
Return whether
verticesare a stable separating set.See
is_stable_set()andis_separating_set()for the description of the parameters.Definitions
- Parameters:
graph (
Graph)vertices (
Collection[Vertex])use_copy (
bool)
- Return type:
Examples
>>> import pyrigi.graphDB as graphs >>> H = graphs.Cycle(5) >>> is_stable_separating_set(H, [1,3]) True >>> is_stable_separating_set(H, [1,2]) False
- pyrigi.graph._other.separating_set.is_stable_set(graph, vertices, certificate=False)[source]¶
Return whether given
verticesform a stable set.If the set is not stable, a pair of adjacent vertices is also returned depending on
certificate.Definitions
- Parameters:
graph (
Graph)vertices (
Collection[Vertex]) – A set of vertices to be checked.certificate (
bool) – IfFalse, a boolean is returned whether the set is stable or not. IfTrue, a tuple is returned where the first boolean states whether the set is stable and the second item gives a pair of vertices contradicting the stable property if applicable (otherwiseNone).
- Return type:
Examples
>>> import pyrigi.graphDB as graphs >>> H = graphs.Cycle(5) >>> is_stable_set(H, [1,3]) True >>> is_stable_set(H, [1,3], certificate=False) True >>> is_stable_set(H, [1,3], certificate=True) (True, None) >>> is_stable_set(H, [1,2], certificate=True) (False, (1, 2)) >>> is_stable_set(H, [0,2,4], certificate=True) (False, (0, 4))
- pyrigi.graph._other.separating_set.is_uv_separating_set(graph, vertices, u, v, use_copy=True)[source]¶
Return whether
verticesseparate the verticesuandv.Definitions
- Parameters:
graph (
Graph)vertices (
Collection[Vertex]) – The set of vertices to be checked to separateuandv. Ifuorvis contained invertices,ValueErroris raised.u (
Vertex)v (
Vertex)use_copy (
bool) – IfTrue(default), create a copy of the graph before the vertices are removed and connectivity is checked. Otherwise, the graph is modified in-place. In that case, some metadata may be lost.
- Return type:
Examples
>>> import pyrigi.graphDB as graphs >>> H = graphs.Cycle(5) >>> is_uv_separating_set(H, [1,3], 0, 2) True >>> is_uv_separating_set(H, [2,4], 0, 1) False
- pyrigi.graph._other.separating_set.stable_separating_set(graph, u=None, v=None, check_flexible=True, check_connected=True, check_distinct_rigid_components=True)[source]¶
Find a stable separating set if the graph is 2-flexible.
If two vertices
uandvthat are not in the same 2-rigid component are provided, then the returned stable separating set separates them. If a single vertexuis specified, the returned stable separating set avoidsu, provideduis not contained in all 2-rigid components. Algorithm 1 in [CGH+24] is used. An empty set can be returned when the graph is disconnected.Definitions
- Parameters:
graph (
Graph)u (
Optional[Vertex]) – See the description above, an arbitrary vertex is chosen if none is specified.v (
Optional[Vertex]) – See the description above, a suitable vertex is chosen if none is specified. It cannot be in the same 2-rigid component asu.check_flexible (
bool) – IfTrue, it is checked that the graph is 2-flexible as the algorithm only works for those. IfFalseand the graph is 2-rigid, the behaviour might be arbitrary.check_connected (
bool) – IfTrue, checks for graph connectivity are run and the result may alter based on them. IfFalseand the graph is disconnected, the behaviour might be arbitrary.check_distinct_rigid_components (
bool) – IfTrue, it is checked thatuandvare in different 2-rigid components. IfFalse, bothuandvmust be specified.
- Return type: