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:
```{python}
# 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:
```{python}
g1=nx.complete_bipartite_graph(5,4)
g2=nx.complete_bipartite_graph(6,4)
```
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.
```{python}
ged=GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print(result)
```
The output is a similarity/distance matrix :
```
Out[10]:
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 :
```
ged.similarity(result)
# or
ged.distance(result)
```
* 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])
setup(
name="GMatch4py",
description="A module for graph matching",
packages=["gmatch4py","gmatch4py.helpers"],
ext_modules=extensions,
cmdclass={'build_ext': build_ext},
setup_requires=["numpy","networkx","networkit"],
install_requires=["numpy","networkx","networkit"],
setup_requires=["numpy","networkx","networkit","scipy"],
install_requires=["numpy","networkx","networkit","scipy"],
version="0.1"
)
#Clean cpp and compiled file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment