Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simple edge and vertex creation.

  • Loading branch information...
commit 16725bf7cec5477658e94735850fc907231c68a9 1 parent 92d49d0
Darrick Wiebe authored

Showing 1 changed file with 16 additions and 4 deletions. Show diff stats Hide diff stats

  1. +16 4 src/pacer/graph.clj
20 src/pacer/graph.clj
@@ -9,22 +9,34 @@
9 9 { :source true
10 10 :type :graph
11 11 :name "TinkerGraph"
12   - :raw-graph (com.tinkerpop.blueprints.impls.tg.TinkerGraph.)
13   - :encoder (pacer/simple-encoder)})
  12 + :raw-graph (atom (com.tinkerpop.blueprints.impls.tg.TinkerGraph.))
  13 + :encoder (atom (pacer/simple-encoder))})
  14 +
  15 +(defn create-vertex [graph]
  16 + { :graph graph
  17 + :type :vertex
  18 + :element (.addVertex @(:raw-graph graph) nil)
  19 + })
  20 +
  21 +(defn create-edge [graph label from to]
  22 + { :graph graph
  23 + :type :edge
  24 + :element (.addEdge @(:raw-graph graph) nil (:element from) (:element to) (str label))
  25 + })
14 26
15 27 (defn v []
16 28 { :source-type :graph
17 29 :type :vertex
18 30 :name "V"
19 31 :iterator (fn iterator [source]
20   - (.. (:raw-graph source) getVertices iterator)) })
  32 + (.. @(:raw-graph source) getVertices iterator)) })
21 33
22 34 (defn e []
23 35 { :source-type :graph
24 36 :type :edge
25 37 :name "E"
26 38 :iterator (fn iterator [source]
27   - (.. (:raw-graph source) getEdges iterator)) })
  39 + (.. @(:raw-graph source) getEdges iterator)) })
28 40
29 41 (defn out-e [& labels]
30 42 { :source-type :vertex

0 comments on commit 16725bf

Please sign in to comment.
Something went wrong with that request. Please try again.