[[ "commandItem" ],[ "commandItem", ["keyword","proc"], ["text"," "], ["identifier","dijkstra"], ["text"," "], ["paren.lparen","{"], ["keyword","graph"], ["text"," "], ["identifier","origin"], ["paren.rparen","}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","# Initialize"] ],[ "commandItem", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","vertex"], ["text"," "], ["identifier","distmap"], ["paren.rparen","}"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$vertex"], ["text"," "], ["identifier","Inf"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$vertex"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$origin"], ["text"," 0"] ],[ "start", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$origin"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["variable.instance","$origin"], ["paren.rparen","]"] ],[ "commandItem", ["text"," "] ],[ "commandItem", ["text"," "], ["keyword","while"], ["text"," "], ["paren.lparen","{"], ["text","["], ["keyword","dict"], ["text"," "], ["identifier","size"], ["text"," "], ["variable.instance","$graph"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["comment","# Find unhandled node with least weight"] ],[ "start", ["text","\t"], ["keyword","set"], ["text"," "], ["identifier","d"], ["text"," "], ["identifier","Inf"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","uu"], ["text"," "], ["support.function","-"], ["paren.rparen","}"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["paren.lparen","{"] ],[ "commandItem", ["text","\t "], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function",">"], ["text"," "], ["paren.lparen","["], ["keyword","set"], ["text"," "], ["identifier","dd"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$uu"], ["paren.rparen","]]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","u"], ["text"," "], ["variable.instance","$uu"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","d"], ["text"," "], ["variable.instance","$dd"] ],[ "commandItem", ["text","\t "], ["paren.rparen","}"] ],[ "commandItem", ["text","\t"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "] ],[ "start", ["text","\t"], ["comment","# No such node; graph must be disconnected"] ],[ "start", ["text","\t"], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function","=="], ["text"," "], ["identifier","Inf"], ["paren.rparen","}"], ["text"," "], ["identifier","break"] ],[ "commandItem", ["text"," "] ],[ "commentfollow", ["text","\t"], ["comment","# Update the weights for nodes\\"] ],[ "start", ["comment","\t lead to by the node we've picked"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","v"], ["text"," "], ["identifier","dd"], ["paren.rparen","}"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["variable.instance","$u"], ["paren.rparen","]"], ["text"," "], ["paren.lparen","{"] ],[ "commandItem", ["text","\t "], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["text","["], ["keyword","dict"], ["text"," "], ["identifier","exists"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","alt"], ["text"," "], ["paren.lparen","["], ["keyword","expr"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function","+"], ["text"," "], ["variable.instance","$dd"], ["paren.rparen","}]"] ],[ "commandItem", ["text","\t\t"], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$alt"], ["text"," "], ["support.function","<"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$v"], ["text"," "], ["variable.instance","$alt"] ],[ "start", ["text","\t\t "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$v"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["support.function","{*}"], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$path"], ["text"," "], ["variable.instance","$u"], ["paren.rparen","]"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]"] ],[ "commandItem", ["text","\t\t"], ["paren.rparen","}"] ],[ "commandItem", ["text","\t "], ["paren.rparen","}"] ],[ "commandItem", ["text","\t"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "] ],[ "start", ["text","\t"], ["comment","# Remove chosen node from graph still to be handled"] ],[ "start", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","unset"], ["text"," "], ["identifier","graph"], ["text"," "], ["variable.instance","$u"] ],[ "commandItem", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$path"], ["paren.rparen","]"] ],[ "commandItem", ["paren.rparen","}"] ]]