Skip to content

Instantly share code, notes, and snippets.

@samaaron
Created October 4, 2010 22:08
Show Gist options
  • Save samaaron/610546 to your computer and use it in GitHub Desktop.
Save samaaron/610546 to your computer and use it in GitHub Desktop.
(ns foo
(:require [loom.io.ubigraph :as ubi]))
(ubi/clear)
(def idxs (doall (take 500 (repeatedly #(ubi/call :new_vertex)))))
(defn rand-idx [els]
(rand-int (count els)))
(defn next-idx [els idx]
(mod (inc idx) (count els)))
(defn link-els [els]
(for [i (range (count els))] (ubi/call :new_edge (nth els i) (nth els (next-idx els i)))))
(link-els idxs)
(doall (for [i (range (count idxs))]
(let [
el (nth idxs i)
new-idxs (doall (for [i (range 10)] (let [new-idx (ubi/call :new_vertex)]
(ubi/call :new_edge el new-idx))))
]
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment