• (add-loops g)
For each node n, add the edge n->n if not already present.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/graph.clj:49 top

(defn add-loops
  "For each node n, add the edge n->n if not already present."
  [g]
  (struct directed-graph
          (:nodes g)
          (into {} (map (fn [n]
                          [n (conj (set (get-neighbors g n)) n)]) (:nodes g)))))
Vars in clojure.contrib.graph/add-loops: defn fn into map struct
Used in 0 other vars

Comments top

No comments for add-loops. Log in to add a comment.