Une mise-à-jour est prévue le 9 juillet entre 13:00 et 14:00. Le service sera inaccessible ou instable pendant cette période. Merci de votre compréhension.

Commit 710e6bba authored by Fize Jacques's avatar Fize Jacques

Add an early Get Started section to the README

parent 3e181588
......@@ -21,13 +21,51 @@ $ python3 setup.py install
## Get Started
### Graph input format
For now, every algorithms class is composed with a static method called `compare()`. `compare()` takes
two arguments :
In `Gmatch4py`, algorithms manipulate `networkx.Graph`, a complete graph model that
comes with a large spectrum of parser to load your graph from various inputs : `*.graphml,*.gexf,..` (check [here](https://networkx.github.io/documentation/stable/reference/readwrite/index.html) to see all the format accepted)
### Use Gmatch4py
If you want to use algorithms like *graph edit distances*, here is an example:
# Gmatch4py use networkx graph
import networkx as nx
# import the GED using the munkres algorithm
from gmatch4py.ged.graph_edit_dist import GraphEditDistance
In this example, we use generated graphs using `networkx` helpers:
All graph matching algorithms in `Gmatch4py work this way:
* Each algorithm is associated with an object, each object having its specific parameters. In this case, the parameters are the edit costs (delete a vertex, add a vertex, ...)
* Each object is associated with a `compare()` function with two parameters. First parameter is **a list of the graphs** you want to **compare**, i.e. measure the distance/similarity (depends on the algorithm). Then, you can specify a sample of graphs to be compared to all the other graphs. To this end, the second parameter should be **a list containing the indices** of these graphs (based on the first parameter list). If you rather compute the distance/similarity **between all graphs**, just use the `None` value.
ged=GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
The output is a similarity/distance matrix :
array([[0., 7.],
[7., 0.]])
This output result is "raw", if you wish to have normalized results in terms of distance (or similarity) you can use :
# or
* An array containing the graphs to compare
* An array containing indexes of graph you want to compare. Set to `None`, if you want to
measure the similarity/distance between every graphs.
## List of algorithms
......@@ -37,21 +37,16 @@ def makeExtension(extName):
extNames = scandir("gmatch4py")
# and build up the set of Extension objects
extensions = cythonize([makeExtension(name) for name in extNames])
description="A module for graph matching",
cmdclass={'build_ext': build_ext},
#Clean cpp and compiled file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment