Comment construire un graphe pondéré avec RGL ou GRATR Ruby pour exécuter l'algorithme de Dijkstra?
Question
Je voudrais voir un exemple d'un algorithme de recherche Dijkastra pour un graphique construit en utilisant RGL Ruby ( http: // RGL .rubyforge.org / ) ou GRATR ( http://rubyforge.org/projects/gratr/ ).
Je sais que GRATR a le soutien Dijkastra mais je ne suis pas vraiment sûr de savoir comment aller de l'utiliser, toute aide serait appréciée.
La solution
L'un d'entre eux devrait aider:
http://snippets.dzone.com/posts/show/7331
http://snippets.dzone.com/posts/show/6100
http://github.com/dbrady/dijkstra
Ceci est un exemple de Dijkstra dans GRATR
http://gratr.rubyforge.org/svn/examples/graph_self.rb
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow