Skip to content

Instantly share code, notes, and snippets.

@t-ob
Created July 11, 2012 23:47
Show Gist options
  • Save t-ob/3094509 to your computer and use it in GitHub Desktop.
Save t-ob/3094509 to your computer and use it in GitHub Desktop.
Graph tour
(defn graph-tour [edges]
(let [vertices (reduce #(into %1 %2) #{} edges)
degree (fn [vertex] (count (filter #(some #{vertex} %) edges)))]
(<= (count (filter odd? (map degree vertices))) 2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment