Closed IslandGod closed 7 years ago
The degree in PageRank is the out_degree i.e. the number of outgoing edges from a vertex. For topological sort, we need the in_degree (number of incoming edges at a vertex). This distinction is meaningful only for directed graphs. this->order
specifies which edges the messages are sent to. It can be GraphMat::IN_EDGES, GraphMat::OUT_EDGES
or GraphMat::ALL_EDGES
.
To calculate the out_degree, we need to send a message from each vertex along its incoming edges and then sum up all the messages that reach a vertex. For example, if a graph is {1 -> 2, 1 -> 3}, then to calculate the out_degree of vertex 1 we need to receive a message from 2 & 3. Vice versa for in_degree.
Hope that helps.
I see , thank you for your response!
I read the definition about Degree in PageRank.cpp and InDegree in TopologicalSort.cpp. I guess they are both used to get in-degrees for all vertexes, but I do not understand that , why it uses
this->order = GraphMat::IN_EDGES;
in PageRank , and it usesthis->order = GraphMat::OUT_EDGES;
in TopologicalSort. What is the differences?Please give me some suggestion or solution. Any info will help, thank you !!