struc2vec
struc2vec copied to clipboard
Support for directed, weighted graphs and code cleanup
I have [see corresponding paper] ...
- added support for directed, weighted graphs
- added support for partially embedding the graph
- cleaned up the code, in particular removed unused parts of the code
- added some missing doc strings
The changes are completely backwards compatible, i.e., any commands that you have been running previously should still work the exact same.
What adjustments are necessary to run on python3?
@joewilaj I got this to run in Python3. Here are the necessary changes:
- replace occurrences of 'xrange' with 'range'
- replace occurrences of 'iter.keys' with 'keys'
- where you see the use of 'G.keys()' put something to convert the output type ('dict_keys') to 'list' where required. G.keys() is usually used to populate the variable 'vertices' which is supposed to be passed to other functions as a 'list' so you have to convert or you'll end up with a "cannot save 'dict_keys' " keys error somewhere
- replace occurrences of 'cPickle' with 'pickle'
- replace occurrences of 'iteritems' with 'items'
- replace the variable names in the Word2Vec call: 'iter' -> 'epochs' and 'size' -> 'vector_size'
That should pretty much do it. As a test run Karate Kid network. BTW it doesn't look like this repo is maintained so that's a shame.