Skip to content

Commit

Permalink
Make graph threadable.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrupp committed Mar 10, 2013
1 parent ac0cc27 commit 5103e40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ Simple graph representation and manipulation in Clojure.
## Usage

```clojure
(let [g (make-graph)]
(add-edge g :a :b)
(add-edge g :a :c)
g)
(let [g (make-graph)]
(add-edge g :a :b)
(add-edge g :a :c))
(-> (make-graph)
(add-edge :a :b)
(add-edge :a :c))
(doto (make-graph)
(add-edge :a :b)
(add-edge :a :c))
```

## License
Expand Down
12 changes: 9 additions & 3 deletions src/graffy/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
(add-node this s)
(add-node this d)
(swap! state update-in [s] conj d)
(swap! state update-in [d] conj s))
(swap! state update-in [d] conj s)
this)
(toString [_]
(.toString @state)))))

(comment
(let [g (make-graph)]
(add-edge g :a :b)
(add-edge g :a :c)
g))
(add-edge g :a :c))
(-> (make-graph)
(add-edge :a :b)
(add-edge :a :c))
(doto (make-graph)
(add-edge :a :b)
(add-edge :a :c)))

0 comments on commit 5103e40

Please sign in to comment.