Weighted page rank graph representation

天涯浪子 提交于 2019-12-08 14:19:48

问题


I have a graph like:

(A, 900, B) //implying it takes 900 hours to move from task A to task B
(B, 800, C) // implying it takes 800 hours to move from B to C.

Now I assume in my page rank algorithm task C should have higher page rank. But it is not happening. I am using Neo4j's page rank algorithm to import the graph. My question is am I representing the graph in an incorrect way.

I think this is a general problem of representing graphs and calculating page ranks based on them.

Should I represent the graph as:

(A, 900/1700, B) //implying weight of edge is 900/1700, where 1700 is sum of edge weights
(B, 800/1700, C) // implying weight of edge is 800/1700

I also wrote a program in python, but the basic question is the same how to represent the edge graph


回答1:


You can use the weight of the edge as the property of the relationship between the two nodes.

(A)-[:CONNECTED_TO {"Time" : 900 }]->(B)

I hope this format helps. For further application, you can refer the docs



来源:https://stackoverflow.com/questions/54626547/weighted-page-rank-graph-representation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!