Skip to content

Commit 2b765b3

Browse files
committed
updated is_brick()
1 parent cdaf8e7 commit 2b765b3

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/sage/graphs/matching_covered_graph.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,15 +2783,15 @@ def is_brick(self, coNP_certificate=False):
27832783
27842784
- If the input nonbipartite matching covered graph is a brick, a
27852785
boolean ``True`` is returned if ``coNP_certificate`` is set to
2786-
``False``, otherwise a 4-tuple ``(True, None, None, None)`` is
2786+
``False``, otherwise a 5-tuple ``(True, None, None, None, None)`` is
27872787
returned.
27882788
27892789
- If the input nonbipartite matching covered graph is not a brick, a
27902790
boolean ``False`` is returned if ``coNP_certificate`` is set to
27912791
``False``.
27922792
27932793
- If ``coNP_certificate`` is set to ``True`` and the input nonbipartite
2794-
graph is not a brick, a 4-tuple of
2794+
graph is not a brick, a 5-tuple of
27952795
27962796
1. a boolean ``False``,
27972797
@@ -2811,8 +2811,14 @@ def is_brick(self, coNP_certificate=False):
28112811
`i` th shore being a proper subset of the `i + 1` th shore.
28122812
28132813
4. a string showing whether the nontrivial tight cuts are barrier
2814-
cuts (if the string is 'nontrivial barrier cuts'), or 2-separation
2815-
cuts (if the string is 'nontrivial 2-separation cuts')
2814+
cuts (if the string is 'nontrivial barrier cut'), or 2-separation
2815+
cuts (if the string is 'nontrivial 2-separation cut')
2816+
2817+
5. a set of vertices showing the respective barrier if the
2818+
nontrivial tight cuts are barrier cuts, or otherwise
2819+
a set of two vertices constituting the corresponding
2820+
two vertex cut (in this case the nontrivial tight cuts are
2821+
2-separation cuts)
28162822
28172823
is returned.
28182824
@@ -2914,13 +2920,13 @@ def is_brick(self, coNP_certificate=False):
29142920
sage: K4 = graphs.CompleteGraph(4)
29152921
sage: G = MatchingCoveredGraph(K4)
29162922
sage: G.is_brick(coNP_certificate=True)
2917-
(True, None, None, None)
2923+
(True, None, None, None, None)
29182924
sage: # K(4) ⊙ K(3, 3) is nonbipartite but not a brick
29192925
sage: H = graphs.MurtyGraph(); H.delete_edge(0, 1)
29202926
sage: G = MatchingCoveredGraph(H)
29212927
sage: G.is_brick(coNP_certificate=True)
29222928
(False, [[(5, 2, None), (6, 3, None), (7, 4, None)]], [{5, 6, 7}],
2923-
'nontrivial barrier cuts')
2929+
'nontrivial barrier cut', {2, 3, 4})
29242930
sage: H = Graph([
29252931
....: (0, 12), (0, 13), (0, 15), (1, 4), (1, 13), (1, 14),
29262932
....: (1, 19), (2, 4), (2, 13), (2, 14), (2, 17), (3, 9),
@@ -2936,7 +2942,7 @@ def is_brick(self, coNP_certificate=False):
29362942
[(19, 1, None), (17, 2, None), (21, 3, None)],
29372943
[(15, 0, None), (14, 1, None), (14, 2, None), (16, 3, None)]],
29382944
[{4, 5, 6, 7, 8, 9, 10, 11, 12}, {17, 18, 19, 20, 21}, {14, 15, 16}],
2939-
'nontrivial barrier cuts')
2945+
'nontrivial barrier cut', {0, 1, 2, 3})
29402946
sage: J = Graph([
29412947
....: (0, 1), (0, 2), (0, 3), (0, 4), (0, 5),
29422948
....: (0, 6), (0, 7), (0, 8), (0, 9), (0, 10),
@@ -2991,7 +2997,8 @@ def is_brick(self, coNP_certificate=False):
29912997
{0, 1, 2, 3, 4},
29922998
{0, 1, 2, 3, 4, 5, 6},
29932999
{0, 1, 2, 3, 4, 5, 6, 7, 8}],
2994-
'nontrivial 2-separation cuts')
3000+
'nontrivial 2-separation cut',
3001+
{0, 11})
29953002
29963003
If the input matching covered graph is bipartite, a
29973004
:exc:`ValueError` is thrown::
@@ -3048,11 +3055,11 @@ def is_brick(self, coNP_certificate=False):
30483055
if (u in nontrivial_odd_component) ^ (v in nontrivial_odd_component)]
30493056
for nontrivial_odd_component in nontrivial_odd_components]
30503057

3051-
return (False, C, nontrivial_odd_components, 'nontrivial barrier cuts')
3058+
return (False, C, nontrivial_odd_components, 'nontrivial barrier cut', B)
30523059

30533060
# Check if G is 3-connected
30543061
if self.is_triconnected():
3055-
return (True, None, None, None) if coNP_certificate else True
3062+
return (True, None, None, None, None) if coNP_certificate else True
30563063

30573064
# G has a 2-vertex cut
30583065
# Compute the SPQR-tree decomposition
@@ -3091,11 +3098,11 @@ def is_brick(self, coNP_certificate=False):
30913098
nontrivial_tight_cut_variation = None
30923099

30933100
if all(len(c) % 2 for c in components):
3094-
nontrivial_tight_cut_variation = 'nontrivial barrier cuts'
3101+
nontrivial_tight_cut_variation = 'nontrivial barrier cut'
30953102
nontrivial_odd_components = [set(component) for component in components if len(component) > 1]
30963103

30973104
else:
3098-
nontrivial_tight_cut_variation = 'nontrivial 2-separation cuts'
3105+
nontrivial_tight_cut_variation = 'nontrivial 2-separation cut'
30993106
nontrivial_odd_components = []
31003107

31013108
for index, component in enumerate(components):
@@ -3114,7 +3121,7 @@ def is_brick(self, coNP_certificate=False):
31143121
for nontrivial_odd_component in nontrivial_odd_components]
31153122

31163123
# Edge (u, v, w) in C are formatted so that u is in a nontrivial odd component
3117-
return (False, C, nontrivial_odd_components, nontrivial_tight_cut_variation) if coNP_certificate else False
3124+
return (False, C, nontrivial_odd_components, nontrivial_tight_cut_variation, set(two_vertex_cut)) if coNP_certificate else False
31183125

31193126
@doc_index('Overwritten methods')
31203127
def loop_edges(self, labels=True):

0 commit comments

Comments
 (0)