GMatch4py
GMatch4py copied to clipboard
graph-edit example from README: TypeError: 'method' object is not iterable
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.
Same problem.
Hi @philipiv and @Sciss,
Sorry for the delay ! I have no idea too... I just reinstall the library and it still works...
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # Gmatch4py use networkx graph
>>> import networkx as nx
>>> # import the GED using the munkres algorithm
>>> import gmatch4py as gm
<frozen importlib._bootstrap>:219: UserWarning: To obtain optimal results install the Cython 'munkres' module at https://github.com/jfrelinger/cython-munkres-wrapper
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)
>>> 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)
[[ 0. 14.]
[10. 0.]]
>>>
On which OS did you install the library ? and which python version ?
Bests, @Jacobe2169