GASM-or 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gasm_or-0.1.0/GASM_or.egg-info/PKG-INFO +128 -0
- gasm_or-0.1.0/GASM_or.egg-info/SOURCES.txt +24 -0
- gasm_or-0.1.0/GASM_or.egg-info/dependency_links.txt +1 -0
- gasm_or-0.1.0/GASM_or.egg-info/requires.txt +25 -0
- gasm_or-0.1.0/GASM_or.egg-info/top_level.txt +1 -0
- gasm_or-0.1.0/LICENSE +674 -0
- gasm_or-0.1.0/PKG-INFO +128 -0
- gasm_or-0.1.0/README.md +82 -0
- gasm_or-0.1.0/gasm/__init__.py +36 -0
- gasm_or-0.1.0/gasm/api.py +152 -0
- gasm_or-0.1.0/gasm/attributes.py +176 -0
- gasm_or-0.1.0/gasm/convergence.py +100 -0
- gasm_or-0.1.0/gasm/cpu/__init__.py +5 -0
- gasm_or-0.1.0/gasm/cpu/core.py +180 -0
- gasm_or-0.1.0/gasm/gpu/__init__.py +5 -0
- gasm_or-0.1.0/gasm/gpu/core.py +278 -0
- gasm_or-0.1.0/gasm/gpu/kernels/gasm.cl +79 -0
- gasm_or-0.1.0/gasm/graph.py +259 -0
- gasm_or-0.1.0/gasm/lap/__init__.py +53 -0
- gasm_or-0.1.0/gasm/lap/auction.py +90 -0
- gasm_or-0.1.0/gasm/lap/jv.py +29 -0
- gasm_or-0.1.0/gasm/matching.py +143 -0
- gasm_or-0.1.0/gasm/metrics.py +87 -0
- gasm_or-0.1.0/gasm/utils.py +26 -0
- gasm_or-0.1.0/pyproject.toml +71 -0
- gasm_or-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: GASM-or
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Graph Attributes and Structure Matching (GASM): graph matching on CPU and GPU.
|
|
5
|
+
Author-email: Raphaël Candelier <raphael.candelier@sorbonne-universite.fr>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/CandelierLab/GASM-or
|
|
8
|
+
Project-URL: Documentation, https://candelierlab.github.io/GASM-or/
|
|
9
|
+
Project-URL: Repository, https://github.com/CandelierLab/GASM-or.git
|
|
10
|
+
Project-URL: Issues, https://github.com/CandelierLab/GASM-or/issues
|
|
11
|
+
Keywords: graph matching,graph similarity,quadratic assignment,linear assignment,networkx,GPU,OpenCL
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.23
|
|
26
|
+
Requires-Dist: scipy>=1.9
|
|
27
|
+
Requires-Dist: networkx>=2.8
|
|
28
|
+
Provides-Extra: gpu
|
|
29
|
+
Requires-Dist: pyopencl>=2022.1; extra == "gpu"
|
|
30
|
+
Provides-Extra: benchmark
|
|
31
|
+
Requires-Dist: matplotlib>=3.6; extra == "benchmark"
|
|
32
|
+
Provides-Extra: doc
|
|
33
|
+
Requires-Dist: sphinx>=7.0; extra == "doc"
|
|
34
|
+
Requires-Dist: furo>=2023.0; extra == "doc"
|
|
35
|
+
Provides-Extra: test
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pyopencl>=2022.1; extra == "dev"
|
|
39
|
+
Requires-Dist: matplotlib>=3.6; extra == "dev"
|
|
40
|
+
Requires-Dist: sphinx>=7.0; extra == "dev"
|
|
41
|
+
Requires-Dist: furo>=2023.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
43
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
44
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# GASM Official Repository
|
|
48
|
+
|
|
49
|
+
A python repository implementing an optimized version of the *Graph Attribute and Structure Matching* ([GASM](https://jgaa.info/index.php/jgaa/article/view/2979)) algorithm on both CPU and GPU.
|
|
50
|
+
|
|
51
|
+
Check out the [documentation](https://candelierlab.github.io/GASM-or/) !
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
pip install --upgrade pip
|
|
57
|
+
pip install GASM-or
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Optional extras:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
pip install "GASM-or[gpu]" # OpenCL GPU back-end (pyopencl)
|
|
64
|
+
pip install "GASM-or[benchmark]" # matplotlib, for the benchmark scripts
|
|
65
|
+
pip install "GASM-or[doc]" # sphinx + furo, to build the documentation
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import gasm
|
|
72
|
+
import networkx as nx
|
|
73
|
+
|
|
74
|
+
G1 = nx.gnp_random_graph(30, 0.1, seed=0)
|
|
75
|
+
G2 = nx.relabel_nodes(G1, {i: (i + 5) % 30 for i in G1.nodes()})
|
|
76
|
+
|
|
77
|
+
M = gasm.match(G1, G2) # GPU by default, CPU fallback
|
|
78
|
+
print(M.matchups) # list of (a, b) matched pairs
|
|
79
|
+
print(M.score) # global matching score
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Force the CPU back-end, add attributes, or evaluate the result:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
M = gasm.match(G1, G2, platform="CPU")
|
|
86
|
+
|
|
87
|
+
attrs = [
|
|
88
|
+
gasm.Attribute("weight", on="edge", kind="measurable", rho=0.1),
|
|
89
|
+
gasm.Attribute("label", on="vertex", kind="categorical"),
|
|
90
|
+
]
|
|
91
|
+
M = gasm.match(G1, G2, attributes=attrs)
|
|
92
|
+
|
|
93
|
+
ground_truth = {i: (i + 5) % 30 for i in G1.nodes()}
|
|
94
|
+
M.accuracy(ground_truth) # fraction of correct pairs
|
|
95
|
+
M.structural_quality(G1, G2) # structural quality qS
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Features
|
|
99
|
+
|
|
100
|
+
- Faithful implementation of GASM for undirected and directed graphs.
|
|
101
|
+
- GPU (OpenCL) and CPU back-ends, with automatic CPU fallback.
|
|
102
|
+
- Vertex and edge attributes, categorical or measurable, with per-attribute uncertainty.
|
|
103
|
+
- Structure-only or attributes-only matching.
|
|
104
|
+
- Automatic complement procedure for dense graphs.
|
|
105
|
+
- Refined adaptive convergence criterion (with the article's fixed-iteration behaviour available on demand).
|
|
106
|
+
- Pluggable linear assignment solvers (Jonker-Volgenant, auction).
|
|
107
|
+
|
|
108
|
+
## Dependencies
|
|
109
|
+
|
|
110
|
+
Requires `numpy`, `scipy` and `networkx`. The GPU back-end additionally requires `pyopencl` and an OpenCL runtime.
|
|
111
|
+
|
|
112
|
+
## Benchmarks
|
|
113
|
+
|
|
114
|
+
The `benchmark/` scripts import the local package and offer quick and full modes:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
python benchmark/accuracy_quality.py --mode quick
|
|
118
|
+
python benchmark/speed.py --mode full --platforms CPU GPU
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
|
|
124
|
+
See the [LICENSE](LICENSE) file for the full text.
|
|
125
|
+
|
|
126
|
+
## Authors and acknowledgment
|
|
127
|
+
|
|
128
|
+
Crafted with ❤️ by Raphaël Candelier.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
GASM_or.egg-info/PKG-INFO
|
|
5
|
+
GASM_or.egg-info/SOURCES.txt
|
|
6
|
+
GASM_or.egg-info/dependency_links.txt
|
|
7
|
+
GASM_or.egg-info/requires.txt
|
|
8
|
+
GASM_or.egg-info/top_level.txt
|
|
9
|
+
gasm/__init__.py
|
|
10
|
+
gasm/api.py
|
|
11
|
+
gasm/attributes.py
|
|
12
|
+
gasm/convergence.py
|
|
13
|
+
gasm/graph.py
|
|
14
|
+
gasm/matching.py
|
|
15
|
+
gasm/metrics.py
|
|
16
|
+
gasm/utils.py
|
|
17
|
+
gasm/cpu/__init__.py
|
|
18
|
+
gasm/cpu/core.py
|
|
19
|
+
gasm/gpu/__init__.py
|
|
20
|
+
gasm/gpu/core.py
|
|
21
|
+
gasm/gpu/kernels/gasm.cl
|
|
22
|
+
gasm/lap/__init__.py
|
|
23
|
+
gasm/lap/auction.py
|
|
24
|
+
gasm/lap/jv.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
numpy>=1.23
|
|
2
|
+
scipy>=1.9
|
|
3
|
+
networkx>=2.8
|
|
4
|
+
|
|
5
|
+
[benchmark]
|
|
6
|
+
matplotlib>=3.6
|
|
7
|
+
|
|
8
|
+
[dev]
|
|
9
|
+
pyopencl>=2022.1
|
|
10
|
+
matplotlib>=3.6
|
|
11
|
+
sphinx>=7.0
|
|
12
|
+
furo>=2023.0
|
|
13
|
+
pytest>=7.0
|
|
14
|
+
build>=1.0
|
|
15
|
+
twine>=4.0
|
|
16
|
+
|
|
17
|
+
[doc]
|
|
18
|
+
sphinx>=7.0
|
|
19
|
+
furo>=2023.0
|
|
20
|
+
|
|
21
|
+
[gpu]
|
|
22
|
+
pyopencl>=2022.1
|
|
23
|
+
|
|
24
|
+
[test]
|
|
25
|
+
pytest>=7.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gasm
|