node2vec icon indicating copy to clipboard operation
node2vec copied to clipboard

Graph with weight

Open Sean0719 opened this issue 6 years ago • 5 comments

Hi,

How can I use this work to embed the graph with weight (such as the distance between tow nodes), could you please give some suggestions? Thanks in advance.

Sean0719 avatar Dec 13 '18 08:12 Sean0719

@Sean0719 If you use python version, just with --weighted.
Such as python node2vec/src/main.py --input xx.edgelist --output xx.embeddings --dimensions 100 --walk-length 100 --num-walks 50 --window-size 30 --p 0.25 --q 4 --iter 5 --weighted
and your edgelist file should like:

780 725 1
266 351 2
285 132 1
328 748 7
275 487 1
259 938 2
.....

DozenCoder avatar Jan 04 '19 08:01 DozenCoder

Okay, thank you very much.

Sean0719 avatar Jan 04 '19 08:01 Sean0719

Hi, One more question, for the weighted node, the weight is used to compute the probability between two node? Thank you very much.

Sean0719 avatar Jan 30 '19 15:01 Sean0719

Hi, One more question, for the weighted node, the weight is used to compute the probability between two node? Thank you very much.

By reading the source code:https://github.com/aditya-grover/node2vec/blob/master/src/node2vec.py#L66, https://github.com/aditya-grover/node2vec/blob/master/src/node2vec.py#L85 , the weight should be used to compute the probability between two node.

DozenCoder avatar Jan 30 '19 15:01 DozenCoder

@Sean0719 If you use python version, just with --weighted. Such as python node2vec/src/main.py --input xx.edgelist --output xx.embeddings --dimensions 100 --walk-length 100 --num-walks 50 --window-size 30 --p 0.25 --q 4 --iter 5 --weighted and your edgelist file should like:

780 725 1
266 351 2
285 132 1
328 748 7
275 487 1
259 938 2
.....

Hello I am trying to run node2 vec how can I use this weight

sonia0028 avatar Jan 19 '20 14:01 sonia0028