Quantcast
Viewing all articles
Browse latest Browse all 7

Ruby Graph + Dijkstra

Dijkstra implementation in ruby, the names of the nodes need not to be integers, works for non directed or directed graphs<code> class Graph # Constructor def initialize @g = {} # the graph // {node => { edge1 => weight, edge2 => weight}, node2 => ... @nodes = Array.new @INFINITY = 1 << 64 end def...

Viewing all articles
Browse latest Browse all 7

Trending Articles