Research Article

Information Spread of Emergency Events: Path Searching on Social Networks

Pseudocode 1

function Dijkstra(Graph, source):
for each vertex v in Graph:
dist v   infinity
previous v   undefined
//save the specific path
dist source   0
Q the set of all nodes in Graph
//initialize the graph
while Q is not empty:
u   node in Q with smallest dist
remove u from Q
for each neighbor v of u:
newdist     dist u   +  
dist_between(u, v)
if newdist < dist v
//do relaxation operation
dist v   alt
previous v u
return previous