Created
October 4, 2010 22:08
-
-
Save samaaron/610546 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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