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

New feature: maximum matching of general graph #2550

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
836b5c3
Add skeleton for max matching function, pseudo code, and tests
EdgarAlenPoe Jan 22, 2024
220e579
tests: added tests for maximum matching
EdgarAlenPoe Jan 25, 2024
020505d
tests: changed tests to use IGRAPH_ASSERT
EdgarAlenPoe Jan 26, 2024
55d82c3
chore: added pseudocode updated maximum matching signature
EdgarAlenPoe Mar 5, 2024
ec44bbf
fix: corrected maximum matching test assertions
EdgarAlenPoe Mar 7, 2024
e3fc9d4
feat: implemented general maximum matching algorithm
EdgarAlenPoe Mar 7, 2024
4202b77
Add VERIFY_FINALLY_STACK to maximum matching test
EdgarAlenPoe Mar 8, 2024
1a90486
Made maximum matching internal functions static
EdgarAlenPoe Mar 8, 2024
eadff75
Removed unnecessary vector
EdgarAlenPoe Mar 8, 2024
fbf2509
replaced struct forest with set of vectors
EdgarAlenPoe Mar 8, 2024
6b6c93c
fixed maximum matching documentation
EdgarAlenPoe Mar 8, 2024
0e5e60a
added example
EdgarAlenPoe Mar 8, 2024
4a2ab55
improved maximum matching tests
EdgarAlenPoe Mar 8, 2024
1be93ff
fixed many bugs in maximum matching algorithm
EdgarAlenPoe Mar 8, 2024
0a19831
cleaned up matching file
EdgarAlenPoe Mar 9, 2024
20d26f5
Merge remote-tracking branch 'upstream/develop' into develop
EdgarAlenPoe Mar 9, 2024
8c33684
removed forgotten merge markers
EdgarAlenPoe Mar 11, 2024
1960f60
Merge branch 'develop' into develop
ntamas Mar 11, 2024
99d3f18
fixed memory leaks in maximum matching example
EdgarAlenPoe Mar 14, 2024
c37c041
fixed invalid read in find_aug_path
EdgarAlenPoe Mar 14, 2024
9144226
added input validation for maximum matching
EdgarAlenPoe Mar 14, 2024
69515fd
Merge remote-tracking branch 'origin/develop' into develop
EdgarAlenPoe Mar 14, 2024
f642e6c
Removed unused variable in maximum matching algorithm
EdgarAlenPoe Mar 14, 2024
8186fb9
fixed error in print statment in example of maximum matching
EdgarAlenPoe Mar 14, 2024
e5f7122
Cleaned up maximum matching tests
EdgarAlenPoe Mar 14, 2024
0b00558
Added tests for maximum matching algorithm
EdgarAlenPoe Mar 15, 2024
628f346
fixed early exit in maximum matching algorithm
EdgarAlenPoe Mar 15, 2024
8475042
Removed debug code in maximum matching test
EdgarAlenPoe Mar 15, 2024
53d48cb
refactored repeated code into seperate function
EdgarAlenPoe Mar 25, 2024
05ed40b
Fixed minor typo in documentation
EdgarAlenPoe Mar 25, 2024
f5d735c
Improved maximum matching test coverage
EdgarAlenPoe Mar 25, 2024
08a7b38
Merge remote-tracking branch 'upstream/develop' into develop
EdgarAlenPoe Mar 25, 2024
8d25852
fixed incorrect function declaration
EdgarAlenPoe Mar 25, 2024
65d5bb3
fixed memory leak in tests
EdgarAlenPoe Mar 25, 2024
4c8046a
fixed memory leak in maximum matching example
EdgarAlenPoe Mar 25, 2024
835f3bc
fixed incorrect function declaration
EdgarAlenPoe Mar 25, 2024
4ac72eb
Merge branch 'develop' into EdmondsBlossom
ntamas Apr 1, 2024
a4cef1d
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 1, 2024
bc94a46
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 3, 2024
530ea59
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 3, 2024
6756561
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 3, 2024
b29589a
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 3, 2024
35af175
reformatch matching sources using astyle
szhorvat Apr 4, 2024
47dbabb
Merge branch 'develop' into EdmondsBlossom
szhorvat Apr 20, 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
45 changes: 45 additions & 0 deletions examples/simple/igraph_maximum_matching.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* -*- mode: C -*- */
/*
IGraph library.
Copyright (C) 2022 The igraph development team <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <igraph.h>

int main(void) {
igraph_t graph;
igraph_vector_int_t matching;
igraph_integer_t matching_size;

igraph_small(&graph, 0, IGRAPH_DIRECTED,
1,2, 1,3, 2,4, 3,5,
4,5, 5,6, 6,8, 6,9,
7,8, 8,9, 8,10, 9,10,
-1);

igraph_vector_int_init(&matching,0);

igraph_maximum_matching(&graph, &matching_size, NULL, &matching, NULL, 0);

printf("matching size is: %" IGRAPH_PRId "\n", matching_size);
printf("matching: ");
igraph_vector_int_print(&matching);

igraph_vector_int_destroy(&matching);
igraph_destroy(&graph);

return 0;
}
4 changes: 4 additions & 0 deletions include/igraph_matching.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ IGRAPH_EXPORT igraph_error_t igraph_maximum_bipartite_matching(const igraph_t* g
igraph_real_t* matching_weight, igraph_vector_int_t* matching,
const igraph_vector_t* weights, igraph_real_t eps);

IGRAPH_EXPORT igraph_error_t igraph_maximum_matching(const igraph_t *graph, igraph_integer_t *matching_size,
igraph_real_t *matching_weight, igraph_vector_int_t *matching,
const igraph_vector_t *weights, igraph_real_t eps);

__END_DECLS

#endif
Loading
Loading