GTmac / HARP

Code for the AAAI 2018 Paper "HARP: Hierarchical Representation Learning for Networks"
MIT License
115 stars 35 forks source link

some codes are required for disconnected graphs maybe? #11

Closed sungjun3010 closed 5 years ago

sungjun3010 commented 5 years ago

hi, i'm trying to apply your method to my project.

but when i ran the code with my graph disconnected, there is an index error for sub-graphs except largest one (at graph_coarsening.py - skipgram_coarsening_disconnected function). i think that is because you give the parameter 'recursive_graphs' to skipgram_coarsening_hs function (line 307) without newly initialize for next sub-graphs.

Am i understood your code right? then, i suggest you add a code like 'recursive_graphs = None' at line between 343 and 344.

GTmac commented 5 years ago

Are you referring to this line: https://github.com/GTmac/HARP/blob/master/src/graph_coarsening.py#L298

Not sure what the problem is -- I tried some disconnected graphs and it works well. recursive_graphs is an array of graphs, what do you mean by "newly initialize for next subgraphs"?

sungjun3010 commented 5 years ago

I think 'recursive_graphs' should be generated for each subgraph because they are disconnected. from the loop statement: https://github.com/GTmac/HARP/blob/src/graph_coarsening.py#L273

At the first iteration, 'recursive_graphs' is generated by the first subgraph. then at the second iteration, 'recursive_graphs' should be re-generated by the second subgraph. but 'recursive_graphs' do not re-generated because 'recursive_graphs' is not None. So I think any code is needed to set 'recursive_graphs' to None before the next iteration.

GTmac commented 5 years ago

I see what you mean. I think you are right :) Nice catch! It would be great if you can help me with fixing it.

sungjun3010 commented 5 years ago

I feel good to help you. I just write a code recursive_graphs = None under https://github.com/GTmac/HARP/blob/src/graph_coarsening.py#L333 with less indent and got a result!

GTmac commented 5 years ago

Fixed now. Thanks again!