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

Introduced the class MatchingCoveredGraph #38742

Merged
merged 93 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
16eb322
Introduced graphs/matching_covered_graph.py
janmenjayap Sep 29, 2024
81bed22
updated the doc
janmenjayap Sep 30, 2024
5189a41
rectified _upgrade_from_graph()
janmenjayap Sep 30, 2024
71ac39a
overwrote allow_loops()
janmenjayap Sep 30, 2024
82d918c
updated a method description
janmenjayap Sep 30, 2024
b164e17
added a test case for disconnected graphs
janmenjayap Sep 30, 2024
2efb686
added a test case for unknown data type
janmenjayap Sep 30, 2024
c6db6fc
restored matching.py
janmenjayap Sep 30, 2024
d65de1e
removed * as functional argument in matching.py
janmenjayap Oct 1, 2024
4c0583e
corrected the problem due to *
janmenjayap Oct 2, 2024
cc18b20
removed spaces around keyword / parameter equals
janmenjayap Oct 2, 2024
3c51d8a
corrected the test with igraph
janmenjayap Oct 2, 2024
a5b3efd
Merge branch 'develop' into mcg
janmenjayap Oct 2, 2024
dfe569a
moved matching_covered_graph to Graph objects and methods
janmenjayap Oct 2, 2024
5ecd500
updated the doc
janmenjayap Oct 2, 2024
9220a9d
updated the documentation
janmenjayap Oct 2, 2024
9b8ab78
updated the code
janmenjayap Oct 2, 2024
e283d1e
updated the code
janmenjayap Oct 2, 2024
55a416a
introduced self.matching
janmenjayap Oct 13, 2024
34bef53
updated the documentation
janmenjayap Oct 13, 2024
adc35e0
introduced get_matching()
janmenjayap Oct 13, 2024
f2b2b3d
made self.matching private
janmenjayap Oct 13, 2024
cce4063
rearranged the methods in lexicographical order
janmenjayap Oct 13, 2024
d83be12
added add_vertex()
janmenjayap Oct 13, 2024
1367acf
added add_vertices()
janmenjayap Oct 13, 2024
f6bbd32
added delete_vertex()
janmenjayap Oct 13, 2024
26deafe
added delete_vertices()
janmenjayap Oct 13, 2024
a90aa33
added update_matching()
janmenjayap Oct 13, 2024
9c2252a
added a doctest
janmenjayap Oct 13, 2024
eec57ab
updated exception statement
janmenjayap Oct 13, 2024
3106204
updated the doctests
janmenjayap Oct 14, 2024
1e18bb2
Merge branch 'develop' into mcg
janmenjayap Oct 14, 2024
46f067a
corrected the use of bare 'except'
janmenjayap Oct 14, 2024
fb94e50
rearranged the methods in lexicographical order
janmenjayap Oct 14, 2024
264bb9a
updated the documentation
janmenjayap Oct 14, 2024
99b8faa
updated the documentation
janmenjayap Oct 15, 2024
7133a28
removed _upgrade_from_graph()
janmenjayap Oct 15, 2024
b19e4db
updated the code
janmenjayap Oct 15, 2024
57670f1
added add_edge()
janmenjayap Oct 15, 2024
f0f7bae
corrected the use of bare 'except'
janmenjayap Oct 15, 2024
c0d90d5
updated the doctests
janmenjayap Oct 15, 2024
7efae8d
removed redundant backslashes
janmenjayap Oct 15, 2024
928bfa5
removed an unnecessary blank line
janmenjayap Oct 15, 2024
a92e227
updated the documentation
janmenjayap Oct 18, 2024
addfe08
made doctests more concise
janmenjayap Oct 18, 2024
c0b1493
updated the doc
janmenjayap Oct 18, 2024
ba1164b
updated the doc and the code
janmenjayap Oct 25, 2024
67b315a
updated the doctests
janmenjayap Oct 25, 2024
c595f43
updated the code and the doc
janmenjayap Oct 27, 2024
ef66f81
added add_edges()
janmenjayap Oct 27, 2024
02154a7
updated delete_vertices()
janmenjayap Oct 27, 2024
0cd3db1
updated add_edges()
janmenjayap Oct 27, 2024
1eaa5ad
updated delete_vertices()
janmenjayap Oct 27, 2024
338f7e9
updated update_matching()
janmenjayap Oct 27, 2024
bddd230
added whitespaces around modulo operator
janmenjayap Oct 27, 2024
c4870d5
Merge branch 'develop' into mcg
janmenjayap Oct 27, 2024
11fc7c8
added TODO methods
janmenjayap Oct 29, 2024
3de9015
changed the description of get_matching()
janmenjayap Oct 29, 2024
adce272
added _subgraph_by_adding()
janmenjayap Oct 29, 2024
a4e8851
corrected a class name
janmenjayap Oct 29, 2024
37c1834
added allows_loops()
janmenjayap Oct 30, 2024
509cfd0
added REFERENCES
janmenjayap Oct 30, 2024
2b49ba0
updated the TODO list
janmenjayap Oct 30, 2024
021ef7c
added doc_index
janmenjayap Oct 30, 2024
58739ef
added _upgrade_from_graph()
janmenjayap Oct 30, 2024
f6c188b
added the file to sage/graphs/meson.build
janmenjayap Oct 30, 2024
aa5d41d
added the book name
janmenjayap Oct 31, 2024
350bba3
added has_perfect_matching()
janmenjayap Nov 4, 2024
d594178
Merge branch 'develop' into mcg
janmenjayap Nov 4, 2024
722d0ce
corrected the indentation
janmenjayap Nov 4, 2024
61c9140
added index of methods
janmenjayap Nov 4, 2024
05dd74a
added one more blankline after the class definition
janmenjayap Nov 4, 2024
2233158
updated the documentation
janmenjayap Nov 4, 2024
27e6536
updated the description of has_perfect_matching()
janmenjayap Nov 5, 2024
1484670
updated the todo list
janmenjayap Nov 5, 2024
b67546e
updated delete_vertex()
janmenjayap Nov 5, 2024
b70350d
added doctests for delete_vertex()
janmenjayap Nov 5, 2024
6a68edf
updated the doctests for _subgraph_by_adding()
janmenjayap Nov 5, 2024
abb1b56
added doctests for _subgraph_by_adding()
janmenjayap Nov 5, 2024
41e46b4
updated the doctests for add_edges()
janmenjayap Nov 5, 2024
17b6e3b
updated the todo list
janmenjayap Nov 5, 2024
a4cc208
Updated the statement for doc index
janmenjayap Nov 6, 2024
91d517a
Updated the doc index for get_matching()
janmenjayap Nov 6, 2024
ba562c9
Updated the import statement for Graph
janmenjayap Nov 6, 2024
62a7a88
updated the description of get_matching()
janmenjayap Nov 6, 2024
0cd4391
updated the todo list
janmenjayap Nov 6, 2024
8f011a7
added doctests for **kwds
janmenjayap Nov 8, 2024
7a2793b
updated __init__()
janmenjayap Nov 8, 2024
83a1be9
added doctests for add_edge()
janmenjayap Nov 8, 2024
7c5c047
updated M_alternating_even_mark()
janmenjayap Nov 8, 2024
bcfe65e
updated is_matching_covered()
janmenjayap Nov 8, 2024
9f32514
updated is_bicritical()
janmenjayap Nov 8, 2024
c63a2bb
removed an unnecessary blank line
janmenjayap Nov 8, 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
1 change: 1 addition & 0 deletions src/doc/en/reference/graphs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Graph objects and methods
sage/graphs/graph
sage/graphs/digraph
sage/graphs/bipartite_graph
sage/graphs/matching_covered_graph
sage/graphs/views

Constructors and databases
Expand Down
1 change: 1 addition & 0 deletions src/sage/graphs/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from sage.graphs.graph import Graph
from sage.graphs.digraph import DiGraph
from sage.graphs.bipartite_graph import BipartiteGraph
from sage.graphs.matching_covered_graph import MatchingCoveredGraph
import sage.graphs.weakly_chordal
import sage.graphs.lovasz_theta
import sage.graphs.partial_cube
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/generic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -14285,7 +14285,7 @@ def _subgraph_by_adding(self, vertices=None, edges=None, edge_property=None, imm
or (v, u) in edges_to_keep_unlabeled)):
edges_to_keep.append((u, v, l))
else:
s_vertices = set(vertices)
s_vertices = set(G.vertices()) if vertices is None else set(vertices)
edges_to_keep = [e for e in self.edges(vertices=vertices, sort=False, sort_vertices=False)
if e[0] in s_vertices and e[1] in s_vertices]

Expand Down
19 changes: 8 additions & 11 deletions src/sage/graphs/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
def has_perfect_matching(G, algorithm='Edmonds', solver=None, verbose=0,
*, integrality_tolerance=1e-3):
r"""
Return whether the graph has a perfect matching
Return whether the graph has a perfect matching.

INPUT:

Expand Down Expand Up @@ -162,7 +162,7 @@ def has_perfect_matching(G, algorithm='Edmonds', solver=None, verbose=0,
def is_bicritical(G, matching=None, algorithm='Edmonds', coNP_certificate=False,
solver=None, verbose=0, *, integrality_tolerance=0.001):
r"""
Check if the graph is bicritical
Check if the graph is bicritical.

A nontrivial graph `G` is *bicritical* if `G - u - v` has a perfect
matching for any two distinct vertices `u` and `v` of `G`. Bicritical
Expand Down Expand Up @@ -270,12 +270,9 @@ def is_bicritical(G, matching=None, algorithm='Edmonds', coNP_certificate=False,

A graph (of order more than two) with more that one component is not bicritical::

sage: cycle1 = graphs.CycleGraph(4)
sage: cycle2 = graphs.CycleGraph(6)
sage: cycle2.relabel(lambda v: v + 4)
sage: G = Graph()
sage: G.add_edges(cycle1.edges() + cycle2.edges())
sage: len(G.connected_components(sort=False))
sage: G = graphs.CycleGraph(4)
sage: G += graphs.CycleGraph(6)
sage: G.connected_components_number()
2
sage: G.is_bicritical()
False
Expand Down Expand Up @@ -1092,7 +1089,7 @@ def matching(G, value_only=False, algorithm='Edmonds',
*, integrality_tolerance=1e-3):
r"""
Return a maximum weighted matching of the graph represented by the list
of its edges
of its edges.

For more information, see the :wikipedia:`Matching_(graph_theory)`.

Expand Down Expand Up @@ -1291,7 +1288,7 @@ def weight(x):

def perfect_matchings(G, labels=False):
r"""
Return an iterator over all perfect matchings of the graph
Return an iterator over all perfect matchings of the graph.

ALGORITHM:

Expand Down Expand Up @@ -1404,7 +1401,7 @@ def rec(G):
def M_alternating_even_mark(G, vertex, matching):
r"""
Return the vertices reachable from ``vertex`` via an even alternating path
starting with a non-matching edge
starting with a non-matching edge.

This method implements the algorithm proposed in [LR2004]_. Note that
the complexity of the algorithm is linear in number of edges.
Expand Down
Loading
Loading