#89
Graph Tour
 

Difficulty:Hard
Topics:graph-theory


Starting with a graph you must write a function that returns true if it is possible to make a tour of the graph in which every edge is visited exactly once. The graph is represented by a vector of tuples, where each tuple represents a single edge. The rules are: - You can start at any node. - You must visit each edge exactly once. - All edges are undirected.
test not run
(= true (__ [[:a :b]]))
test not run
(= false (__ [[:a :a] [:b :b]]))
test not run
(= false (__ [[:a :b] [:a :b] [:a :c] [:c :a]
               [:a :d] [:b :d] [:c :d]]))
test not run
(= true (__ [[1 2] [2 3] [3 4] [4 1]]))
test not run
(= true (__ [[:a :b] [:a :c] [:c :b] [:a :e]
              [:b :e] [:a :d] [:b :d] [:c :e]
              [:d :e] [:c :f] [:d :f]]))
test not run
(= false (__ [[1 2] [2 3] [2 4] [2 5]]))


Code which fills in the blank: