phanein / deepwalk

DeepWalk - Deep Learning for Graphs
http://www.perozzi.net/projects/deepwalk/
Other
2.67k stars 828 forks source link

_write_walks_to_disk crashes for the non-str walk items #98

Open luav opened 5 years ago

luav commented 5 years ago

Walks persistence fails for the non-str walk items (in case the module is used as a library from https://github.com/eXascaleInfolab/HARP with int walk items).

  File "/usr/local/lib/python3.5/dist-packages/deepwalk-1.0.3-py3.5.egg/deepwalk/walks.py", line 85, in write_walks_to_disk
    for file_ in executor.map(_write_walks_to_disk, args_list):
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 556, in result_iterator
    yield future.result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 405, in result
    return self.__get_result()
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
TypeError: sequence item 0: expected str instance, int found
GTmac commented 5 years ago

It seems that the problem is with HARP -- we assume that walk items are all strings in DeepWalk.

luav commented 5 years ago

@GTmac Up to you. In theory, the type of walk items should not affect the execution: the graph nodes are just some objects (more compact in case of numerical ids than text strings). This small fix does not affect the persistence of the walk items having str type, it just makes possible to persist the walk items of any other type.