jacquesfize / gmatch4py Goto Github PK
View Code? Open in Web Editor NEWA graph matching library for Python
License: MIT License
A graph matching library for Python
License: MIT License
Attempting to install GMatch4py for Python 3.5 and Python 3.6 on Mojave in a virtual environment fails with clang reporting:
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
This is because the deployment target isn't being recognized by clang. This can be rectified by doing export MACOSX_DEPLOYMENT_TARGET=10.14
before running the build.
Finally, the FutureWarning reported by Cython:
FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release!
can be resolved by changing the extensions line in setup.py
to:
extensions = cythonize([makeExtension(name) for name in extNames], compiler_directives={'language_level': '3'})
Reference: https://stackoverflow.com/a/53992016
I'm not sure if I am misunderstanding this, but is it not possible to only pass node attributes or edge attributes, without necessarily having to pass both of them? From base.py I observe:
def set_attr_graph_used(self, *args, **kwargs): # real signature unknown """ Set graph attribute used by the algorithm to compare graphs. Parameters ---------- node_attr_key : str key of the node attribute edge_attr_key: str key of the edge attribute """ pass
Considering that people in python often make use networkx to represent their graphs, the output of the compare() function may seem confusing to some people. The output for the networkx version of graph edit distance leads to single number like: 2.0.
For gmatch4py this is a cost matrix like: [[1. 0. ] [0.17535545 1. ]] (normalized). I thought that it may be interesting to add in your documentation an explanation on how to interpret this cost matrix.
I have a bunch of graphs I know to be unique, and when I calculate GED using GraphEditDistance it returns non-zero values as expected. However when using HED instead of GraphEditDistance, it outputs only 0.
ged = gm.HED(1, 1, 1, 1)
result = ged.compare(all_graph, None)
print(*result)
Is my code wrong or is there an issue with the library?
Hi, in the readme it appears that:
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
The costs are adding and removing nodes and edges?
but what is the order of the costs?
Hi, it won't install. (Windows 10)
It generates a long error log, but it seems that this is the most informative part:
ERROR: Failed building wheel for GMatch4py
Running setup.py clean for GMatch4py
Failed to build GMatch4py
DEPRECATION: Could not build wheels for GMatch4py which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: GMatch4py, Cython
Running setup.py install for GMatch4py ... error
ERROR: Command errored out with exit status 1:
Having trouble importing gmatch4py. Looks like there's a deeper problem importing the munkres package. I've installed it with pip install munkres
and it installed fine. Trying to install if from https://github.com/jfrelinger/cython-munkres-wrapper
as suggested in the error report prompts an error about not being about to detect the archive format.
What am I doing wrong?
User entry:
C:\Users\user>python
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 01:31:54) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmatch4py
The error:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\importlib\_bootstrap.py:219: UserWarning: To obtain optimal results install the Cython 'munkres' module at https://github.com/jfrelinger/cython-munkres-wrapper
return f(*args, **kwds)
Traceback (most recent call last):
File "gmatch4py\ged\abstract_graph_edit_dist.pyx", line 13, in gmatch4py.ged.abstract_graph_edit_dist
ImportError: cannot import name munkres
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gmatch4py\__init__.py", line 4, in <module>
from .ged.graph_edit_dist import *
File "gmatch4py\ged\graph_edit_dist.pyx", line 1, in init gmatch4py.ged.graph_edit_dist
File "gmatch4py\ged\abstract_graph_edit_dist.pyx", line 16, in init gmatch4py.ged.abstract_graph_edit_dist
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\optimize\__init__.py", line 390, in <module>
from .optimize import *
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\optimize\optimize.py", line 37, in <module>
from .linesearch import (line_search_wolfe1, line_search_wolfe2,
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\optimize\linesearch.py", line 18, in <module>
from scipy.optimize import minpack2
ImportError: DLL load failed: The specified module could not be found.
>>>
Hi there. Already running into the next problem:
$ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> import gmatch4py as gm
/usr/lib/python3.7/importlib/_bootstrap.py:219: UserWarning: To obtain optimal results install the Cython 'munkres' module at https://github.com/jfrelinger/cython-munkres-wrapper
return f(*args, **kwds)
>>> g1=nx.complete_bipartite_graph(5,4)
>>> g2=nx.complete_bipartite_graph(6,4)
>>> ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
>>> result=ged.compare([g1,g2],None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gmatch4py/ged/abstract_graph_edit_dist.pyx", line 179, in gmatch4py.ged.abstract_graph_edit_dist.AbstractGraphEditDistance.compare
File "gmatch4py/ged/abstract_graph_edit_dist.pyx", line 182, in gmatch4py.ged.abstract_graph_edit_dist.AbstractGraphEditDistance.compare
File "gmatch4py/helpers/general.pyx", line 21, in gmatch4py.helpers.general.parsenx2graph
TypeError: 'method' object is not iterable
I have no idea why this error occurs.
Hello,
I'm trying to use this library for the first time. In particular, I'm trying to embed my graph using Graph2Vec approach. As there's no much documentation, I'm basically testing functions like a monkey, nevertheless I had this error:
g = nx.barabasi_albert_graph(200, 10)
e = gm.embedding.graph2vec.generate_model(g)
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
r = call_item()
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
return self.fn(*self.args, **self.kwargs)
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in __call__
return self.func(*args, **kwargs)
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/joblib/parallel.py", line 262, in __call__
return [func(*args, **kwargs)
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/joblib/parallel.py", line 262, in <listcomp>
return [func(*args, **kwargs)
File "gmatch4py/embedding/graph2vec.pyx", line 114, in gmatch4py.embedding.graph2vec.feature_extractor
File "gmatch4py/embedding/graph2vec.pyx", line 89, in gmatch4py.embedding.graph2vec.dataset_reader
File "/home/cittaro.davide/.conda/envs/schist/lib/python3.8/site-packages/networkx/classes/function.py", line 75, in degree
return G.degree(nbunch, weight)
AttributeError: 'int' object has no attribute 'degree'
"""
The above exception was the direct cause of the following exception:
AttributeError Traceback (most recent call last)
<ipython-input-23-b5451756c7d9> in <module>
----> 1 g1v = gm.embedding.graph2vec.generate_model(g1)
gmatch4py/embedding/graph2vec.pyx in gmatch4py.embedding.graph2vec.generate_model()
~/.conda/envs/schist/lib/python3.8/site-packages/joblib/parallel.py in __call__(self, iterable)
1059
1060 with self._backend.retrieval_context():
-> 1061 self.retrieve()
1062 # Make sure that we get a last message telling us we are done
1063 elapsed_time = time.time() - self._start_time
~/.conda/envs/schist/lib/python3.8/site-packages/joblib/parallel.py in retrieve(self)
938 try:
939 if getattr(self._backend, 'supports_timeout', False):
--> 940 self._output.extend(job.get(timeout=self.timeout))
941 else:
942 self._output.extend(job.get())
~/.conda/envs/schist/lib/python3.8/site-packages/joblib/_parallel_backends.py in wrap_future_result(future, timeout)
540 AsyncResults.get from multiprocessing."""
541 try:
--> 542 return future.result(timeout=timeout)
543 except CfTimeoutError as e:
544 raise TimeoutError from e
~/.conda/envs/schist/lib/python3.8/concurrent/futures/_base.py in result(self, timeout)
437 raise CancelledError()
438 elif self._state == FINISHED:
--> 439 return self.__get_result()
440 else:
441 raise TimeoutError()
~/.conda/envs/schist/lib/python3.8/concurrent/futures/_base.py in __get_result(self)
386 def __get_result(self):
387 if self._exception:
--> 388 raise self._exception
389 else:
390 return self._result
AttributeError: 'int' object has no attribute 'degree'
I'm ready to be warned about the wrong usage of the function above.
Deepwalk is a node embedding algorithm (graph embedding ≠ node embedding). As each run of a node embedding can be rotated with an orthogonal rotation matrix doing any sort of comparison of two node embedding is totally meaningless. I am also somewhat surprised to see large blocks of code from my graph2vec repository.
Hi,
Do you have a function that gives the node matchings between two graphs ?
Sincerely.
Hi!
Thanks for sharing this project! It would be really nice if we can get at least some simple examples of how to use it?
I am mostly interested in testing graph distances with edit distance, but fail to produce an working example.
Regards
Bojan
Hi, When I executed this command sudo python3 setup.py install
, I encountered the following error.
veradeMacBook-Pro:GMatch4py vera$ sudo python3 setup.py install
Password:
gmatch4py/kernels/weisfeiler_lehman.pyx: cannot find cimported module '..base'
gmatch4py/vertex_ranking.pyx: cannot find cimported module '.base'
gmatch4py/vertex_edge_overlap.pyx: cannot find cimported module '.base'
gmatch4py/mcs.pyx: cannot find cimported module '.base'
gmatch4py/bag_of_cliques.pyx: cannot find cimported module '.base'
gmatch4py/bon.pyx: cannot find cimported module '.base'
gmatch4py/jaccard.pyx: cannot find cimported module '.base'
gmatch4py/ged/graph_edit_dist.pyx: cannot find cimported module '.abstract_graph_edit_dist'
gmatch4py/ged/graph_edit_dist.pyx: cannot find cimported module '..base'
gmatch4py/ged/graph_edit_dist.pxd: cannot find cimported module '.abstract_graph_edit_dist'
gmatch4py/ged/bipartite_graph_matching_2.pyx: cannot find cimported module '..base'
gmatch4py/ged/greedy_edit_distance.pyx: cannot find cimported module '.graph_edit_dist'
gmatch4py/ged/hausdorff_edit_distance.pyx: cannot find cimported module '..base'
gmatch4py/ged/abstract_graph_edit_dist.pyx: cannot find cimported module '..base'
gmatch4py/ged/abstract_graph_edit_dist.pxd: cannot find cimported module '..base'
/anaconda3/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
/anaconda3/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'setup_requires'
warnings.warn(msg)
/anaconda3/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/gmatch4py
copying gmatch4py/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/gmatch4py
creating build/lib.macosx-10.7-x86_64-3.7/gmatch4py/helpers
copying gmatch4py/helpers/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/gmatch4py/helpers
running build_ext
building 'gmatch4py.kernels.random_walk_kernel' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/gmatch4py
creating build/temp.macosx-10.7-x86_64-3.7/gmatch4py/kernels
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c gmatch4py/kernels/random_walk_kernel.cpp -o build/temp.macosx-10.7-x86_64-3.7/gmatch4py/kernels/random_walk_kernel.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
creating build/lib.macosx-10.7-x86_64-3.7/gmatch4py/kernels
g++ -bundle -undefined dynamic_lookup -L/anaconda3/lib -arch x86_64 -L/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/gmatch4py/kernels/random_walk_kernel.o -o build/lib.macosx-10.7-x86_64-3.7/gmatch4py/kernels/random_walk_kernel.cpython-37m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
My env is in anaconda python3.6, Mac 10.14(Mojave)
I compare two graphs as follows:
g1=nx.DiGraph()
g1.add_edges_from([(0,3),(1,3),(2,3)])
g1.nodes[0]['type'] = 'Attack'
g1.nodes[1]['type'] = 'Attack'
g1.nodes[2]['type'] = 'Attack'
g1.nodes[3]['type'] = 'Die'
g2=nx.DiGraph()
g2.add_edges_from([(0,3),(1,3),(2,3)])
g2.nodes[0]['type'] = 'Die'
g2.nodes[1]['type'] = 'Die'
g2.nodes[2]['type'] = 'Die'
g2.nodes[3]['type'] = 'Attack'
ged = gm.GraphEditDistance(1,1,1,1)
ged.set_attr_graph_used('type',None)
result = ged.compare([g1,g2],None)
And the comparing result is
[[0,0],
[0,0]]
So it seems that the ged didn't consider the 'type' attribute?
Hi,
I have a simple code to compare the computed graph edit distance with GMatch4py and also the graph_edit_distance function in networkx.
my code is as follows:
g1=nx.complete_graph(3)
g2=nx.complete_graph(4)
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print("GMatch4py output:\n", result)
print("networkx output:\n", nx.graph_edit_distance(g1,g2))
and the results are:
GMatch4py output:
[[0. 7.]
[7. 0.]]
networkx output:
4.0
Would you please tell me what does each element of the output matrix of GMatch4py mean? Is 7 the edit distance computed by GMatch4py while the exact edit distance is 4? Is the performance and accuracy of GMatchpy low even for very small graphs or it is just an understanding mistake made by me?
Regards
This simple example shows a different edit distance compared to networkX's GED. Would be great if someone could help me understand the difference. From my understanding of GED, the edit distance should be 1, not 2.
import networkx
import gmatch4py as gm
g1=nx.complete_bipartite_graph(2,3)
g2=nx.complete_bipartite_graph(2,3)
g2.add_edge(0, 1)
adj=[(v, neighbors) for v, neighbors in g1.adjacency()]
print(adj)
adj=[(v, neighbors) for v, neighbors in g2.adjacency()]
print(adj)
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print(result)
[(0, {2: {}, 3: {}, 4: {}}), (1, {2: {}, 3: {}, 4: {}}), (2, {0: {}, 1: {}}), (3, {0: {}, 1: {}}), (4, {0: {}, 1: {}})]
[(0, {2: {}, 3: {}, 4: {}, 1: {}}), (1, {2: {}, 3: {}, 4: {}, 0: {}}), (2, {0: {}, 1: {}}), (3, {0: {}, 1: {}}), (4, {0: {}, 1: {}})]
[[0. 2.]
[2. 0.]]
ged_nx = nx.graph_edit_distance(g1, g2)
print(ged_nx)
1.0
Hi.
I have a question about the substitution cost. When we define
ged=gm.GraphEditDistance(1,1,1,1)
, I think that the parameters are equal to node_del,node_ins,edge_del,edge_ins
. Is there a way to input user-defined substitution cost matrix (e.g., a cost of 1 for a mis-match between two edges A and B, and a cost of 0 if two edges are identical)? Or the substitution costs are computed automatically?
Thank you.
Tran.
After running python setup.py install
:
Terminal prompted with the following error:
gmatch4py/mcs.cpp:27:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Hi,
I have a question about the maximum graph edit distance between two graphs.
If Graph A has M nodes, B has N nodes, what is the maximum graph edit distance calculated by GMatch4py between A and B? Is there an upper bound? Whether the maximum graph editing distance depends on M and N?
Finally, which paper presented the calculation algorithm used in GMatch4py?
Looking forward to reply!
Hi,
I am very new to python and Graphs, but I need these similarity measures in a project.
so my question could be a little retarded, sorry.
I tried to install the package as described. (using command prompt)
git clone https://github.com/Jacobe2169/GMatch4py.git
cd GMatch4py
(sudo) pip(3) install .
The first two commands work, but the third does not.
neither (sudo) or (pip3) are recognized .
Fisrt I tried with (sudo): (sudo) pip(3) install .
Then with pip3 (without (sudo)): pip3 install
Then with pip (without (sudo)): pip install
could you help me please?
thanks a lot.
Hi there! Thanks for making this project. I'm following the setup in the README, but something is wrong. I installed using pip3 install .
, then I run python3
, at the prompt I type
>>> # Gmatch4py use networkx graph
... import networkx as nx
>>> # import the GED using the munkres algorithm
... import gmatch4py as gm
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/hhrutz/Documents/devel/GMatch4py/gmatch4py/__init__.py", line 4, in <module>
from .ged.graph_edit_dist import *
ModuleNotFoundError: No module named 'gmatch4py.ged.graph_edit_dist'
Hello,
I did a fresh install on an Ubuntu 18.04.1 virtual machine. If I follow the steps in the readme all is fine to install. However when I run an example, I get this output:
I build a simple setup.py to test:
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("simpleGmatch4py.pyx")
)
I create a simpleGmatch4py.pyx:
import networkx as nx
import gmatch4py as gm
g1=nx.complete_bipartite_graph(5,4)
g2=nx.complete_bipartite_graph(6,4)
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print(result)
print("Done")
I build inplace:
python3 setup.py build_ext --inplace
I then try to run it and get an error:
python3
import simpleGmatch4py
Traceback (most recent call last):
File "", line 1, in
File "simpleGmatch4py.pyx", line 4, in init simpleGmatch4py
import gmatch4py as gm
File "/usr/local/lib/python3.6/dist-packages/gmatch4py/init.py", line 4, in
from .ged.graph_edit_dist import *
File "gmatch4py/ged/graph_edit_dist.pyx", line 1, in init GMatch4py.gmatch4py.ged.graph_edit_dist
ModuleNotFoundError: No module named 'GMatch4py'
This error is similar to Issue #2. In Issue #2 the virtualenv method works perfectly.
Digging further, If I do the additional steps:
While I do get it to work, it is not install/working as expected. I hope these details help.
Thank you again for your amazing work! :)
Hi can i use a edge image as a input to Hausdorff ?
Thank you !
Hi! incredible promises in your Readme.md (speed through Cython, easy API, etc.)
But I found the library a bit unfinished, so here are some (hopefully) constructive feedback:
git clone
etc. in clean env, as required by readme.md, and just doing import gmatch4py as gm
, I still encounter an import issue: from .embedding.deepwalk import *
File "gmatch4py/embedding/deepwalk.pyx", line 29, in init gmatch4py.embedding.deepwalk
ModuleNotFoundError: No module named 'graph'
Autocompletion not working: maybe it's just in my IDE (Pycharm Pro), but I have no autocomplete of functions signatures, or no doctsrings displayed°. Do you have on your side?
2 bis) I know it takes time, but docs are not ultra clear for some functions (for example, how does .set_attr_graph_used
works, how does it actually "use" attributes)
aka 2 bis²) : why does .set_attr_graph_used
always took 2 arguments, can't we just use edge attr or node attr ? It seems not, but it's not clear to me why.
TypeError: set_attr_graph_used() takes exactly 2 positional arguments (1 given)
° I think it might be because of compiled files .so
. From my researchs, it seems docstrings are dropped by defaullt. But here, they give an option to keep docstrings:
Cython.Compiler.Options.docstrings = True
Have a nice day, I hope my feedback will be useful. Again, thanks for open-sourcing your work!
Nicolas MICAUX
When I try to import gmatch4py, the below error happens:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-789a2ae4f894> in <module>
----> 1 import gmatch4py as gm
c:\users\XXX\appdata\local\programs\python\python39\lib\site-packages\gmatch4py\__init__.py in <module>
13 # Graph Embedding import
14 from .embedding.graph2vec import *
---> 15 from .embedding.deepwalk import *
16 from .embedding.node2vec import *
17 # Helpers import
gmatch4py\embedding\deepwalk.pyx in init gmatch4py.embedding.deepwalk()
ModuleNotFoundError: No module named 'skipgram'
Thanks for a great library.
I'd like to calculate GED using node properties aka attributes. Like another issue, this doesn't seem to work in practice: #26
A starting point might be that the set_attr_graph_used
doesn't appear to do anything. I'm afraid I don't know how to fix this, since the function does apparently change the attribute: https://github.com/Jacobe2169/GMatch4py/blob/4fc0a822514c65c0d8b12d090b5b89c0af50ef2a/gmatch4py/base.pyx#L68
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
ged.set_attr_graph_used("atomicNum",'hi')
ged.node_attr_key
output:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/jh/02165y2n7kq2y5ychxtzcjm40000gn/T/ipykernel_37896/2867113632.py in <module>
1 ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
2 ged.set_attr_graph_used("atomicNum",'hi')
----> 3 ged.node_attr_key
AttributeError: 'gmatch4py.ged.graph_edit_dist.GraphEditDistance' object has no attribute 'node_attr_key'
The docs mention that the library supports to incorporate node attributes when computing the distance. Without diving deeply into the code, how is this implemented, that is, how are two feature vectors compared to yield a distance?
Hello!
I'd love to try this out, but the installation appears to be broken. Using Ubuntu18.04 I
I build a simple setup.py to test:
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("simpleGmatch4py.pyx")
)
I create a simpleGmatch4py.pyx:
# Gmatch4py use networkx graph
import networkx as nx
# import the GED using the munkres algorithm
import gmatch4py as gm
g1=nx.complete_bipartite_graph(5,4)
g2=nx.complete_bipartite_graph(6,4)
ged=gm.GraphEditDistance(1,1,1,1) # all edit costs are equal to 1
result=ged.compare([g1,g2],None)
print(result)
print("Hello")
I build inplace:
python3 setup.py build_ext --inplace
I then try to run it and get an error:
python3
>>import simpleGmatch4py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "simpleGmatch4py.pyx", line 4, in init simpleGmatch4py
import gmatch4py as gm
File "/usr/local/lib/python3.6/dist-packages/gmatch4py/__init__.py", line 4, in <module>
from .ged.graph_edit_dist import *
File "gmatch4py/ged/graph_edit_dist.pyx", line 1, in init GMatch4py.gmatch4py.ged.graph_edit_dist
ModuleNotFoundError: No module named 'GMatch4py'
Please help :)
Hi,
Thank you for GMatch4py which seems to works in my computer.
My question is the following:
in my graph, there 3 attributes, 2 on nodes and one a edges.
If an attribute is a float, is it considered as a weight ?
For example, if on the edges I have the distances as attributes, should I transform this attribute to give the more important weights to the shortest distances ?
Hi. When I import gmatch4py there is a warning: for optimal results, the Cython 'munkres' module must be installed. But when entering the given url this is totally deprecated and it is impossible to install. How much does this affect the operation of gmatch4py?
Hi,I don't know why my emails to you are always unsuccessful, it seems to be the server's reason, so I have to come here to try to contact you, hoping to contact you!
When I reproduced your code of Toponym Geocoding, I found that the data link you gave in the code link can't be opened.For the data needed for the experiment, can you share with me the link that is available now or share the data with me via email?
My email is 360519152@com.
Hello, I just installed gmatch4py
using pip install git+https://github.com/Jacobe2169/GMatch4py.git
, without any errors showing up. Then when I try to import the library, I always get this Error:
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 13
11 from grakel import Graph
12 from grakel.kernels import RandomWalk, ShortestPath, WeisfeilerLehman, GraphletSampling, SubgraphMatching
---> 13 import gmatch4py as gm
File ~\Documents\ece ntua\διπλωματικη\Notebooks-Scripts\thesis_venv\lib\site-packages\gmatch4py\__init__.py:15
13 # Graph Embedding import
14 from .embedding.graph2vec import *
---> 15 from .embedding.deepwalk import *
16 from .embedding.node2vec import *
17 # Helpers import
File gmatch4py\embedding\deepwalk.pyx:29, in init gmatch4py.embedding.deepwalk()
ModuleNotFoundError: No module named 'graph'
Is there any other dependency/module that I should manually install??
Thanks
Hi,
I noticed that if I don't begin with the examples given in your document, GMatch4py fails and gives:
_
TypeError Traceback (most recent call last)
in
----> 1 result=ged.compare([Gx1, Gx2, Gx3],None)
2 print(result)gmatch4py/ged/abstract_graph_edit_dist.pyx in gmatch4py.ged.abstract_graph_edit_dist.AbstractGraphEditDistance.compare()
gmatch4py/ged/abstract_graph_edit_dist.pyx in gmatch4py.ged.abstract_graph_edit_dist.AbstractGraphEditDistance.compare()
gmatch4py/helpers/general.pyx in gmatch4py.helpers.general.parsenx2graph()
gmatch4py/graph.pyx in gmatch4py.graph.Graph.init()
TypeError: Expected str, got int
_
If I begin with your example and do the same thing it works!
Is it possible to get the edit path (not just the distance) between two graphs for any of the graph edit algorithms?
What would be the citation for the following algorithm implemented in this library?
https://github.com/Jacobe2169/GMatch4py/blob/master/gmatch4py/ged/graph_edit_dist.pyx
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.