Skip to content

Added New Hypergraph Matching Algorithms #157

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

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8fa0503
new env
bonicim May 17, 2024
88a3c4e
Merge remote-tracking branch 'origin/master'
rotshira May 22, 2024
d177aab
test+algo
rotshira May 22, 2024
cf1dd09
test+algo - fix
rotshira May 23, 2024
8f13bba
mathcing algo
rotshira May 28, 2024
8e4746a
mathcing algo
rotshira May 28, 2024
ce45e5b
fixed correct doctest
nivmoti May 28, 2024
66c59f9
Merge remote-tracking branch 'origin/master'
nivmoti May 28, 2024
57f1c81
test
rotshira May 28, 2024
91e7142
fixed correct tests
nivmoti May 28, 2024
1d47083
Merge remote-tracking branch 'origin/master'
nivmoti May 28, 2024
44b897f
update test & algo
rotshira Jun 2, 2024
6be80e5
Merge remote-tracking branch 'origin/master'
rotshira Jun 2, 2024
62c44db
Greedy algorithm implementation
rotshira Jun 4, 2024
37df82a
iterated_sampling algorithm implementation
rotshira Jun 4, 2024
55ae566
iterated_sampling algorithm implementation
rotshira Jun 4, 2024
5dda9d9
HEDCS_matching
rotshira Jun 4, 2024
f1ca740
alGo 1+2 WORK
rotshira Jun 6, 2024
44e36bf
matching_algorithms 1+2+3 WORK
rotshira Jun 6, 2024
7b47222
tests classes 1+2+3 WORK
rotshira Jun 6, 2024
f2a35df
fix all
rotshira Jun 6, 2024
11b7011
fixed correct tests fixed the functions
nivmoti Jun 6, 2024
277ee71
fixed correct tests fixed the functions vol.2
nivmoti Jun 6, 2024
e260887
fixed correct tests fixed the functions vol.3
nivmoti Jun 11, 2024
cae3b6b
complete functions with test
nivmoti Jun 12, 2024
4b69793
Tests and algorithm - final
rotshira Jun 13, 2024
c71ad7e
Tests - final
rotshira Jun 19, 2024
4f89f00
add logging debug
nivmoti Jun 24, 2024
bc359a0
performance comparison
nivmoti Jun 25, 2024
ce7df25
performance comparison
rotshira Jun 26, 2024
ee479b9
logs
erelsgl Jul 1, 2024
ba97f47
logs
erelsgl Jul 1, 2024
1a25284
remove backup folder
erelsgl Jul 1, 2024
26879ae
Website - demonstration of the algorithm
rotshira Jul 10, 2024
8b11a78
website fix
nivmoti Jul 11, 2024
184080b
Turtial notebook
nivmoti Jul 17, 2024
44b7f77
Merge remote-tracking branch 'origin/master'
nivmoti Jul 17, 2024
5f2143d
Update matching_algorithms_tutorial.ipynb
nivmoti Jul 24, 2024
5182eac
fixing problems
nivmoti Jul 29, 2024
bd68ec5
fixing problems
nivmoti Jul 29, 2024
44794e6
Merge branch 'master' into master
nivmoti Jul 29, 2024
43bef53
Merge remote-tracking branch 'upstream/master'
nivmoti Jul 30, 2024
a9363cd
Merge remote-tracking branch 'origin/master'
nivmoti Jul 30, 2024
244bccd
put the app website
nivmoti Jul 31, 2024
e651635
fix problems
nivmoti Jul 31, 2024
239aaac
Matching Algorithms pull changes
nivmoti Aug 25, 2024
98cdb92
Merge branch 'master' into master
erelsgl Sep 2, 2024
48e7b3c
Delete hypernetx/algorithms/cc.py
rotshira Sep 2, 2024
517131c
Update __init__.py
rotshira Sep 2, 2024
acb908e
Update Advanced 6 - Hypergraph Modularity and Clustering.ipynb
rotshira Sep 2, 2024
cb27fb3
Update Advanced 6 - Hypergraph Modularity and Clustering.ipynb
rotshira Sep 2, 2024
b388b91
Update __init__.py
nivmoti Sep 11, 2024
17c6862
Matching Algorithms pull changes
nivmoti Sep 12, 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
61 changes: 61 additions & 0 deletions docs/source/algorithms/matching_algorithms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Matching Algorithms for Hypergraphs
===================================

Introduction
------------
This module implements various algorithms for finding matchings in hypergraphs. These algorithms are based on the methods described in the paper:

*Distributed Algorithms for Matching in Hypergraphs* by Oussama Hanguir and Clifford Stein.

The paper addresses the problem of finding matchings in d-uniform hypergraphs, where each hyperedge contains exactly d vertices. The matching problem is NP-complete for d ≥ 3, making it one of the classic challenges in computational theory. The algorithms described here are designed for the Massively Parallel Computation (MPC) model, which is suitable for processing large-scale hypergraphs.

Mathematical Foundation
------------------------
The algorithms in this module provide different trade-offs between approximation ratios, memory usage, and computation rounds:

1. **O(d²)-approximation algorithm**:
- This algorithm partitions the hypergraph into random subgraphs and computes a matching for each subgraph. The results are combined to obtain a matching for the original hypergraph.
- Approximation ratio: O(d²)
- Rounds: 3
- Memory: O(√nm)

2. **d-approximation algorithm**:
- Uses sampling and post-processing to iteratively build a maximal matching.
- Approximation ratio: d
- Rounds: O(log n)
- Memory: O(dn)

3. **d(d−1 + 1/d)²-approximation algorithm**:
- Utilizes the concept of HyperEdge Degree Constrained Subgraphs (HEDCS) to find an approximate matching.
- Approximation ratio: d(d−1 + 1/d)²
- Rounds: 3
- Memory: O(√nm) for linear hypergraphs, O(n√nm) for general cases.

These algorithms are crucial for applications that require scalable parallel processing, such as combinatorial auctions, scheduling, and multi-agent systems.

Usage Example
-------------
Below is an example of how to use the matching algorithms module.

```python
from hypernetx.algorithms import matching_algorithms as ma

# Example hypergraph data
hypergraph = ... # Assume this is a d-uniform hypergraph

# Compute a matching using the O(d²)-approximation algorithm
matching = ma.matching_approximation_d_squared(hypergraph)

# Compute a matching using the d-approximation algorithm
matching_d = ma.matching_approximation_d(hypergraph)

# Compute a matching using the d(d−1 + 1/d)²-approximation algorithm
matching_d_squared = ma.matching_approximation_dd(hypergraph)

print(matching, matching_d, matching_d_squared)


References
-------------

- Oussama Hanguir, Clifford Stein, Distributed Algorithms for Matching in Hypergraphs, https://arxiv.org/pdf/2009.09605
13 changes: 13 additions & 0 deletions hypernetx/algorithms/__init__.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the Matching Algorithm API

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
hypergraph_homology_basis,
interpret,
)
from hypernetx.algorithms.matching_algorithms import (
greedy_matching,
maximal_matching,
iterated_sampling,
HEDCS_matching,
approximation_matching_checking,
)
from hypernetx.algorithms.s_centrality_measures import (
s_betweenness_centrality,
s_harmonic_closeness_centrality,
Expand Down Expand Up @@ -116,4 +123,10 @@
"two_section",
"kumar",
"last_step",
# matching_algorithms API's
"greedy_matching",
"maximal_matching",
"iterated_sampling",
"HEDCS_matching",
"approximation_matching_checking",
]
Loading