jacquesfize / GMatch4py

A graph matching library for Python
MIT License
192 stars 41 forks source link

Graph2Vec error #27

Open dawe opened 3 years ago

dawe commented 3 years ago

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.