Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GMatch4py
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fize Jacques
GMatch4py
Commits
fbb020c3
Commit
fbb020c3
authored
Jul 10, 2018
by
Fize Jacques
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug WLK and GED
Change README
parent
01d33886
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
24 deletions
+26
-24
README.md
README.md
+7
-10
gmatch4py/ged/graph_edit_dist.pyx
gmatch4py/ged/graph_edit_dist.pyx
+3
-2
gmatch4py/kernels/weisfeiler_lehman.pyx
gmatch4py/kernels/weisfeiler_lehman.pyx
+11
-5
setup.py
setup.py
+5
-7
No files found.
README.md
View file @
fbb020c3
...
...
@@ -11,17 +11,14 @@ Gmatch4py is a library dedicated to graph matching. Graph structure are stored i
## Installation
First, compile the library by running this command
:
To install
`GMatch4py`
, run the following commands
:
```
$ python3 setup.py build_ext
$ git clone https://github.com/Jacobe2169/GMatch4py.git
$ cd GMatch4py
$ python3 setup.py install
```
Then, install the compiled module with:
```
$ pip3 install .
```
## Get Started
...
...
@@ -75,8 +72,8 @@ each code is associated with a reference to the original.**
*
Debug algorithms with --> (
*debug needed*
)
*
Improve code structure and performance
*
Simplify
`setup.py`
*
Simplify
`setup.py`
:heavy_check_mark:
*
Some algorithms are distance and others are similarity measure. Must change the compare
methods so it can adapt to the user need. For example, maybe the user want to deal with
graph similarity rather than distance between graph.
*
Write the documentation
\ No newline at end of file
graph similarity rather than distance between graph.:heavy_check_mark:
*
Write the documentation :see_no_evil:
\ No newline at end of file
gmatch4py/ged/graph_edit_dist.pyx
View file @
fbb020c3
...
...
@@ -26,9 +26,10 @@ cdef class GraphEditDistance(AbstractGraphEditDistance):
R2
=
nx
.
create_empty_copy
(
H
)
R2
.
add_edges_from
(
H
.
edges
(
node2
,
data
=
True
))
return
abs
(
R2
.
number_of_edges
()
-
intersection
(
R
,
R2
).
number_of_edges
())
diff
=
abs
(
R2
.
number_of_edges
()
-
intersection
(
R
,
R2
).
number_of_edges
())
return
(
diff
*
self
.
edge_ins
)
+
(
diff
*
self
.
edge_del
)
else
:
return
self
.
node_ins
+
self
.
node_del
return
0.
cdef
double
delete_cost
(
self
,
int
i
,
int
j
,
nodesG
,
G
):
if
i
==
j
:
...
...
gmatch4py/kernels/weisfeiler_lehman.pyx
View file @
fbb020c3
...
...
@@ -17,12 +17,18 @@ import copy
import
networkx
as
nx
import
numpy
as
np
cimport
numpy
as
np
from
..base
cimport
Base
cdef
class
WeisfeleirLehmanKernel
(
Base
):
class
WeisfeleirLehmanKernel
(
object
):
__type__
=
"sim"
@
staticmethod
def
compare
(
graph_list
,
selected
,
h
=
2
):
cdef
int
h
def
__init__
(
self
,
h
=
2
):
Base
.
__init__
(
self
,
0
,
True
)
self
.
h
=
h
cpdef
np
.
ndarray
compare
(
self
,
list
graph_list
,
list
selected
):
"""Compute the all-pairs kernel values for a list of graphs.
This function can be used to directly compute the kernel
matrix for a list of graphs. The direct computation of the
...
...
@@ -103,7 +109,7 @@ class WeisfeleirLehmanKernel(object):
new_labels
=
copy
.
deepcopy
(
labels
)
# Can't work without it !!!
while
it
<
h
:
while
it
<
self
.
h
:
# create an empty lookup table
label_lookup
=
{}
label_counter
=
0
...
...
setup.py
View file @
fbb020c3
...
...
@@ -9,6 +9,8 @@ except:
print
(
"You don't seem to have Cython installed. Please get a"
)
print
(
"copy from www.cython.org and install it"
)
sys
.
exit
(
1
)
def
scandir
(
dir
,
files
=
[]):
for
file
in
os
.
listdir
(
dir
):
path
=
os
.
path
.
join
(
dir
,
file
)
...
...
@@ -18,7 +20,6 @@ def scandir(dir, files=[]):
scandir
(
path
,
files
)
return
files
# generate an Extension object from its dotted name
def
makeExtension
(
extName
):
extPath
=
extName
.
replace
(
"."
,
os
.
path
.
sep
)
+
".pyx"
...
...
@@ -34,12 +35,9 @@ extNames = scandir("gmatch4py")
extensions
=
cythonize
([
makeExtension
(
name
)
for
name
in
extNames
])
setup
(
name
=
"G
m
atch4py"
,
name
=
"G
M
atch4py"
,
description
=
"A module for graph matching"
,
packages
=
[
"gmatch4py"
],
#ext_modules=cythonize([
# Extension("*", ["gmatch4py/*.pyx"],include_dirs=[np.get_include()])
#]),
packages
=
[
"gmatch4py"
,
"gmatch4py.ged"
,
"gmatch4py.kernels"
],
ext_modules
=
extensions
,
cmdclass
=
{
'build_ext'
:
build_ext
},
setup_requires
=
[
"numpy"
,
"networkx"
],
...
...
@@ -47,7 +45,7 @@ setup(
version
=
"0.1"
)
#Clean cpp and compiled file
f
=
Fals
e
f
=
Tru
e
if
f
:
if
os
.
path
.
exists
(
"build"
):
shutil
.
rmtree
(
"build"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment