snowkylin / line

TensorFlow implementation of paper "LINE: Large-scale Information Network Embedding" by Jian Tang, et al.
203 stars 82 forks source link

second order similarity issue #6

Open yfyang86 opened 5 years ago

yfyang86 commented 5 years ago

When we handle the second order similarity, why we need a random switch node strategy (i.e. beginning/ending nodes)?

https://github.com/snowkylin/line/blob/4cdfa7ada95858e8c3c1d78af5cdd1713357cd64/utils.py#L41

In the original paper, it enables developers to utilize the homogenous graph ("an undirected edge can be considered as two directed edges with opposite directions and equal weights").

snowkylin commented 5 years ago

This only applies when G is an undirected graph (nx.Graph rather than nx.DiGraph). This "switch node strategy" is equal to dividing an undirected edge to two directed edges with opposite directions and equal weights.

bruceli518 commented 5 years ago

I also can't understand this operation, no matter switching the head and tail nodes or not, you only input the edge in one direction. But in the original paper, it said if the graph is undirected, you are supposed to input an edge in two directions.