@@ -2566,14 +2566,24 @@ def is_brace(self, coNP_certificate=False):
25662566 sage: len(L) == len(M)
25672567 True
25682568
2569- A cycle graph of order six of more is a bipartite matching covered
2569+ A cycle graph of order six or more is a bipartite matching covered
25702570 graph, but is not a brace::
25712571
25722572 sage: C = graphs.CycleGraph(10)
25732573 sage: G = MatchingCoveredGraph(C)
25742574 sage: G.is_brace()
25752575 False
25762576
2577+ A ladder graph of order six or more is a bipartite matching covered
2578+ graph, that is not a brace. The tight cut decomposition of a ladder
2579+ graph produces a list graphs the underlying graph of each of which
2580+ is isomorphic to a 4-cycle::
2581+
2582+ sage: L = graphs.LadderGraph(10)
2583+ sage: G = MatchingCoveredGraph(L)
2584+ sage: G.is_brace()
2585+ False
2586+
25772587 One may set the ``coNP_certificate`` to be ``True``::
25782588
25792589 sage: H = graphs.HexahedralGraph()
@@ -2593,6 +2603,19 @@ def is_brace(self, coNP_certificate=False):
25932603 True
25942604 sage: for u, v, *_ in nontrivial_tight_cut:
25952605 ....: assert (u in nontrivial_odd_component and v not in nontrivial_odd_component)
2606+ sage: L = graphs.LadderGraph(3) # A ladder graph with two constituent braces
2607+ sage: G = MatchingCoveredGraph(L)
2608+ sage: is_brace, nontrivial_tight_cut, nontrivial_odd_component = G.is_brace(coNP_certificate=True)
2609+ sage: is_brace is False
2610+ True
2611+ sage: G1 = L.copy()
2612+ sage: G1.merge_vertices(list(nontrivial_odd_component))
2613+ sage: G1.to_simple().is_isomorphic(graphs.CycleGraph(4))
2614+ True
2615+ sage: G2 = L.copy()
2616+ sage: G2.merge_vertices([v for v in G if v not in nontrivial_odd_component])
2617+ sage: G2.to_simple().is_isomorphic(graphs.CycleGraph(4))
2618+ True
25962619
25972620 If the input matching covered graph is nonbipartite, a
25982621 :exc:`ValueError` is thrown::
@@ -2612,7 +2635,6 @@ def is_brace(self, coNP_certificate=False):
26122635
26132636 .. SEEALSO::
26142637
2615- - :meth:`~sage.graphs.graph.Graph.is_bicritical`
26162638 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.is_brick`
26172639 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.bricks_and_braces`
26182640 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.number_of_braces`
@@ -2635,7 +2657,7 @@ def is_brace(self, coNP_certificate=False):
26352657 H = Graph (self , multiedges = False )
26362658 H .delete_vertices ([u , v ])
26372659
2638- if not H .is_matching_covered (list (matching - set ([e ]))):
2660+ if not H .is_connected () or not H . is_matching_covered (list (matching - set ([e ]))):
26392661 if not coNP_certificate :
26402662 return False
26412663
@@ -2686,6 +2708,8 @@ def dfs(v, visited, neighbor_iterator):
26862708 X = set ()
26872709 dfs (root , X , D .neighbor_out_iterator )
26882710
2711+ color_class = None
2712+
26892713 for a , b in H .edge_iterator (labels = False , sort_vertices = True ):
26902714 if (a in X ) ^ (b in X ):
26912715 x = a if a in A else b
@@ -2694,7 +2718,7 @@ def dfs(v, visited, neighbor_iterator):
26942718
26952719 # Obtain the color class Z ∈ {A, B} such that X ∩ Z is a vertex cover for T(e)
26962720 # Thus, obtain Y := X + v
2697- X .add (u if (not color_class and u in A ) or (color_class and u in B ) else v )
2721+ X .add (u if (not color_class and u in A ) or (color_class and u in B ) or ( color_class is None ) else v )
26982722
26992723 # Compute the nontrivial tight cut C := ∂(Y)
27002724 C = [(u , v , w ) if u in X else (v , u , w )
@@ -2862,6 +2886,7 @@ def is_brick(self, coNP_certificate=False):
28622886 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.bricks_and_braces`
28632887 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.number_of_bricks`
28642888 - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.number_of_petersen_bricks`
2889+ - :meth:`~sage.graphs.matching_covered_graph.MatchingCoveredGraph.tight_cut_decomposition`
28652890 """
28662891 if self .is_bipartite ():
28672892 raise ValueError ('the input graph is bipartite' )
0 commit comments