thunlp / OpenNE

An Open-Source Package for Network Embedding (NE)
MIT License
1.68k stars 485 forks source link

Some questions about directed graph #40

Closed Freyr-Wings closed 5 years ago

Freyr-Wings commented 6 years ago

adj[look_up[edge[0]]][look_up[edge[1]]] = 1.0 adj[look_up[edge[1]]][look_up[edge[0]]] = 1.0 The code is found in tadw and grarep. Is it means that the method can only be used in undirected graph?

Freyr-Wings commented 6 years ago

Also, why uses look_up ? The nodes already have their corresponding index in the edge list.

zzy14 commented 6 years ago

Yes, most methods based on matrix factorization need the undirected graph. I think lookup will be useful for the non-numeric nodes.

Freyr-Wings commented 6 years ago

Then I find these two things while doing the experiment

  1. embeddings may have a higher score on the undirected wiki graph than an directed one;
  2. if I specified the graph to an undirected one by doing this g.read_edgelist(filename="data/wiki/Wiki_edgelist.txt", weighted=False, directed=False) then it would be a better choice to call adj[look_up[edge[0]]][look_up[edge[1]]] = self.g.G[edge[0]][edge[1]]['weight'] Since in graph.py you have correctly modified the graph and the sums of adj on axis 1 and axis 0 will have same results.

By which I mean, maybe one line of the code above is enough and maybe it will be better to mark the experiments which are only suitable for undirected graph

By the way, I also implement some network embedding methods myself and will make a pull request soon : )