Graph Matching Framework
This is a Cython framework to perform graph matching. It uses the flexibility of python and the efficiency of compiled c code to package contains the core files to perform graph matching.
Installation
Prerequisites
- Python 3.9
- Numpy
- A C++ compatible compiler
Install
# Clone repo
git clone https://github.com/CheshireCat12/graph-matching-core.git [folder-name]
# Move to repo directory
cd [folder-name]
#Create python virtual environment with python
python -m venv venv
source venv/bin/activate
# Install Numpy
pip install numpy
# Compile and install the code
pip install -e .
Run tests
python -m pytest tests
How to use
# More example available in ./tests/
from cyged.graph_pkg_core import GED
from cyged.graph_pkg_core.edit_cost.edit_cost_vector import EditCostVector
from cyged.graph_pkg_core.graph.edge import Edge
from cyged.graph_pkg_core import Graph
from cyged.graph_pkg_core.graph.label.label_edge import LabelEdge
from cyged.graph_pkg_core.graph.label.label_node_vector import LabelNodeVector
from cyged.graph_pkg_core.graph.node import Node
from cyged.graph_pkg_core import LoaderVector
ged = GED(EditCostVector(1., 1., 1., 1., 'euclidean'))
n, m = 4, 3
graph_source = Graph('gr_source', 'gr_source.gxl', n)
graph_target = Graph('gr_target', 'gr_targe.gxl', m)
# Init graph source: add nodes and edges
graph_source.add_node(Node(0, LabelNodeVector(np.array([1.]))))
graph_source.add_node(Node(1, LabelNodeVector(np.array([2.]))))
graph_source.add_node(Node(2, LabelNodeVector(np.array([1.]))))
graph_source.add_node(Node(3, LabelNodeVector(np.array([3.]))))
graph_source.add_edge(Edge(0, 1, LabelEdge(0)))
graph_source.add_edge(Edge(1, 2, LabelEdge(0)))
graph_source.add_edge(Edge(1, 3, LabelEdge(0)))
graph_source.add_edge(Edge(2, 3, LabelEdge(0)))
# Init graph target: add nodes and edges
graph_target.add_node(Node(0, LabelNodeVector(np.array([3.]))))
graph_target.add_node(Node(1, LabelNodeVector(np.array([2.]))))
graph_target.add_node(Node(2, LabelNodeVector(np.array([2.]))))
graph_target.add_edge(Edge(0, 1, LabelEdge(0)))
graph_target.add_edge(Edge(1, 2, LabelEdge(0)))
edit_cost = ged.compute_edit_distance(graph_source, graph_target)
Parallelization
[...]
from cyged.graph_pkg_core.algorithm.matrix_distances import MatrixDistances
ged = GED(EditCostVector(1., 1., 1., 1., 'euclidean'))
# List of graphs
source_graphs = [grs1, grs2, ..., grsm]
target_graphs = [grt1, grt2, ..., grtn]
mat_dist = MatrixDistances(ged, parallel=True)
mat_edit_dist = mat_dist.calc_matrix_distances(source_graphs,
target_graphs,
heuristic=True,
num_cores=8)
Cite
Please cite our paper if you use this code in your work:
@inproceedings{GilliozR22,
author = {Anthony Gillioz and
Kaspar Riesen},
editor = {Maria De Marsico and
Gabriella Sanniti di Baja and
Ana L. N. Fred},
title = {Improving Graph Classification by Means of Linear Combinations of
Reduced Graphs},
booktitle = {Proceedings of the 11th International Conference on Pattern Recognition
Applications and Methods, {ICPRAM} 2022, Online Streaming, February
3-5, 2022},
pages = {17--23},
publisher = {{SCITEPRESS}},
year = {2022},
url = {https://doi.org/10.5220/0010776900003122},
doi = {10.5220/0010776900003122}
}
Metadata
Release files for cyged 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cyged-0.2.3.tar.gz | 17.1 kB | Without provenance | Details for cyged-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cyged-0.2.3-cp39-cp39-manylinux_2_17_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details for cyged-0.2.3-cp39-cp39-manylinux_2_17_x86_64.whl |
Total release size: 3.1 MB
Release files / cyged-0.2.3.tar.gz
| Download URL | cyged-0.2.3.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0261ca6fcaf6a4e3acadb0299edee04340d2b5a0cba8c8d756bacbcb928a6a8
|
|
BLAKE2b-256 checksum How to use checksums |
21d3a663a3e282a0babe8141be31b6ff060688652124a100a09b897112917534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / cyged-0.2.3-cp39-cp39-manylinux_2_17_x86_64.whl
| Download URL | cyged-0.2.3-cp39-cp39-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5c343f6f8e1dc5f80f43b0aeac53e0818ea0133bd8b7f0665c09bf642740031e
|
|
BLAKE2b-256 checksum How to use checksums |
337d6bc4c800f8f41244917340ce0b6e34c17de7c08ee0bed930a13f9d819d3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for cyged 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.