Skip to content

Instantly share code, notes, and snippets.

View mjg123's full-sized avatar
😅

Matthew Gilliard mjg123

😅
View GitHub Profile
@mjg123
mjg123 / dijkstra-core.clj
Created May 29, 2012 22:34 — forked from tcoupland/dijkstra-core.clj
Brisfunctional dojo code implementing dijkstra's algorithm 29-05-2012
(ns dijkstra.core)
(def initial-node {:score Integer/MAX_VALUE :route [] :dead? false})
(defn make-initial-state [edges start-node]
(-> (zipmap (keys edges) (repeat initial-node))
(assoc-in [start-node :score] 0)
(assoc-in [start-node :route] [start-node])))
(defn live-nodes [state]