Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented methods concerning bricks and braces of a matching covered graph #39065

Open
wants to merge 32 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
66e9724
added is_brace()
janmenjayap Dec 1, 2024
86bd2e9
updated the to do list
janmenjayap Dec 1, 2024
dc47497
updated the digraph H
janmenjayap Dec 1, 2024
e5d74e2
updated the doctest
janmenjayap Dec 1, 2024
4b43897
updated is_matching_covered()
janmenjayap Dec 1, 2024
0eb894d
updated is_brace()
janmenjayap Dec 1, 2024
ce1e3aa
Merge branch 'develop' into bricks_and_braces
janmenjayap Dec 1, 2024
451f164
removed an unnecessary space
janmenjayap Dec 1, 2024
74ea027
updated the documentation
janmenjayap Dec 1, 2024
9c3936b
updated is_brace()
janmenjayap Dec 1, 2024
430b837
updated is_brace()
janmenjayap Dec 2, 2024
b1b8b8b
Updated math expression formatting
janmenjayap Dec 5, 2024
67f484b
Merge branch 'develop' into bricks_and_braces
janmenjayap Dec 5, 2024
ac8987e
Merge branch 'develop' into bricks_and_braces
janmenjayap Dec 13, 2024
d319860
added is_brick()
janmenjayap Dec 13, 2024
564cbbb
updated is_brace()
janmenjayap Dec 13, 2024
ad33ccf
Merge branch 'develop' into bricks_and_braces
janmenjayap Dec 16, 2024
0f6ca22
updated is_brick()
janmenjayap Dec 21, 2024
adb95be
updated is_brace()
janmenjayap Dec 21, 2024
e101d33
updated see also
janmenjayap Dec 21, 2024
b2f917d
Merge branch 'bricks_and_braces' of https://github.com/janmenjayap/sa…
janmenjayap Dec 21, 2024
b7c274e
updated the doctests
janmenjayap Dec 21, 2024
b8fdab8
updated connected components parameter
janmenjayap Dec 21, 2024
cb4d3d1
updated the return statement of is_brick()
janmenjayap Dec 21, 2024
d670168
updated the return statement of is_brace()
janmenjayap Dec 21, 2024
03771ee
updated is_brace()
janmenjayap Dec 21, 2024
8a14b4c
updated is_brick()
janmenjayap Dec 21, 2024
d295290
updated doctests
janmenjayap Dec 21, 2024
b619b57
updated the doctests
janmenjayap Dec 22, 2024
a24f7e5
Merge branch 'develop' into bricks_and_braces
janmenjayap Dec 23, 2024
babb6bb
introduced tight_cut_decomposition()
janmenjayap Dec 23, 2024
7455ac0
removed a whitespace
janmenjayap Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions src/sage/graphs/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def is_matching_covered(G, matching=None, algorithm='Edmonds', coNP_certificate=
sage: H = graphs.PathGraph(20)
sage: M = H.matching()
sage: H.is_matching_covered(matching=M, coNP_certificate=True)
(False, (1, 2, None))
(False, (2, 1, None))

TESTS:

Expand Down Expand Up @@ -1019,44 +1019,33 @@ def is_matching_covered(G, matching=None, algorithm='Edmonds', coNP_certificate=
if color[u]:
u, v = v, u

if M.has_edge(u, v):
H.add_edge(u, v)
else:
H.add_edge(v, u)
H.add_edge((u, v))
if next(M.neighbor_iterator(u)) == v:
H.add_edge((v, u))

# Check if H is strongly connected using Kosaraju's algorithm
def dfs(J, v, visited, orientation):
def dfs(v, visited, neighbor_iterator):
stack = [v] # a stack of vertices

while stack:
v = stack.pop()
visited.add(v)

if v not in visited:
visited[v] = True

if orientation == 'in':
for u in J.neighbors_out(v):
if u not in visited:
stack.append(u)

elif orientation == 'out':
for u in J.neighbors_in(v):
if u not in visited:
stack.append(u)
else:
raise ValueError('Unknown orientation')
for u in neighbor_iterator(v):
if u not in visited:
stack.append(u)

root = next(H.vertex_iterator())

visited_in = {}
dfs(H, root, visited_in, 'in')
visited_in = set()
dfs(root, visited_in, H.neighbor_in_iterator)

visited_out = {}
dfs(H, root, visited_out, 'out')
visited_out = set()
dfs(root, visited_out, H.neighbor_out_iterator)

for edge in H.edge_iterator():
u, v, _ = edge
if (u not in visited_in) or (v not in visited_out):
if (u not in visited_out) or (v not in visited_in):
if not M.has_edge(edge):
return (False, edge) if coNP_certificate else False

Expand Down
Loading
Loading