Liking cljdoc? Tell your friends :D

lucid.graph.draw.dom


diff-domclj

(diff-dom graph diff)

diffs the graph with a set of changes to be made

(-> (reset-graph) (diff-dom {:> {}, :- {[:nodes :c] {:label "c"}}}) (get-dom)) => {:nodes {:b {:label "b"}, :a {:label "a"}}, :edges {[:a :b] {:label "a->b"}}}

diffs the graph with a set of changes to be made

(-> (reset-graph)
    (diff-dom {:> {},
               :- {[:nodes :c] {:label "c"}}})
    (get-dom))
=> {:nodes {:b {:label "b"},
            :a {:label "a"}},
    :edges {[:a :b] {:label "a->b"}}}
raw docstring

edgeclj

(edge graph k)

Accesses an edge within the graph
(-> (edge (reset-graph) [:a :b]) (object/to-data)) => {:attributes {:label "a->b"}, :id [:a :b]}

Accesses an edge within the graph  
(-> (edge (reset-graph) [:a :b])
    (object/to-data))
=> {:attributes {:label "a->b"}, :id [:a :b]}
raw docstring

elementclj

(element graph k)

Accesses the element in the graph, be it a node or a cess (-> (element (reset-graph) :a) (object/to-data)) => {:attributes {:label "a"}, :id :a}

Accesses the element in the graph, be it a node or a cess
(-> (element (reset-graph) :a)
    (object/to-data))
=> {:attributes {:label "a"}, :id :a}
raw docstring

get-domclj

(get-dom graph)

Gets the nodes and edges of the graph (get-dom (reset-graph)) => {:nodes {:a {:label "a"}, :b {:label "b"}, :c {:label "c"}} :edges {[:a :b] {:label "a->b"}}}

Gets the nodes and edges of the graph
(get-dom (reset-graph))
=> {:nodes {:a {:label "a"}, :b {:label "b"}, :c {:label "c"}}
    :edges {[:a :b] {:label "a->b"}}}
raw docstring

make-patchclj

(make-patch diff)

creates a patch for updating the graph from a data diff (make-patch {:> {}, :- {}, :+ {[:nodes :c] {:label "c"}, [:nodes :b] {:label "b"}, [:nodes :a] {:label "a"}}}) => {:attributes {:+ {:b {:label "b"}, :c {:label "c"}, :a {:label "a"}}}, :nodes {:+ #{:c :b :a}}}

creates a patch for updating the graph from a data diff
(make-patch {:> {},
                 :- {},
                 :+ {[:nodes :c] {:label "c"},
                     [:nodes :b] {:label "b"},
                     [:nodes :a] {:label "a"}}})
=> {:attributes {:+ {:b {:label "b"},
                     :c {:label "c"},
                    :a {:label "a"}}},
    :nodes {:+ #{:c :b :a}}}
raw docstring

make-patch-attributesclj

(make-patch-attributes out arr v sign)

creates an entry for patching element attributes (make-patch-attributes {} [:nodes :a] {:label "hello"} :-) => {:attributes {:- {:nodes {:a {:label "hello"}}}}}

(make-patch-attributes {} [:nodes] {:a {:label "hello"}} :-) => {:attributes {:- {:nodes {:a {:label "hello"}}}}}

creates an entry for patching element attributes
(make-patch-attributes {} [:nodes :a] {:label "hello"} :-)
=> {:attributes {:- {:nodes {:a {:label "hello"}}}}}

(make-patch-attributes {} [:nodes] {:a {:label "hello"}} :-)
=> {:attributes {:- {:nodes {:a {:label "hello"}}}}}
raw docstring

make-patch-elementclj

(make-patch-element m type k sign)

creates an entry for patching a element (make-patch-element {} :nodes :a :+) => {:nodes {:+ #{:a}}}

creates an entry for patching a element
(make-patch-element {} :nodes :a :+)
=> {:nodes {:+ #{:a}}}
raw docstring

nodeclj

(node graph k)

Accesses a node within the graph (-> (node (reset-graph) :a) (object/to-data)) => {:attributes {:label "a"}, :id :a}

Accesses a node within the graph
(-> (node (reset-graph) :a)
    (object/to-data))
=> {:attributes {:label "a"}, :id :a}
raw docstring

patchclj

(patch graph patch)

Takes in a graph and a patch of the graph and applies (-> (reset-graph) (patch {:nodes {:- #{:b}}, :attributes {:+ {:c {:ui.class "hello"}, [:a :c] {:ui.class "world"}}}, :edges {:+ #{[:a :c]} :- #{[:a :b]}}}) (get-dom)) => {:nodes {:a {:label "a"}, :c {:label "c", :ui.class "hello"}}, :edges {[:a :c] {:ui.class "world"}}}

Takes in a graph and a patch of the graph and applies 
 (-> (reset-graph)
     (patch {:nodes {:- #{:b}},
             :attributes {:+ {:c {:ui.class "hello"},
                              [:a :c] {:ui.class "world"}}},
             :edges {:+ #{[:a :c]}
                     :- #{[:a :b]}}})
     (get-dom))
=> {:nodes {:a {:label "a"},
             :c {:label "c", :ui.class "hello"}},
     :edges {[:a :c] {:ui.class "world"}}}
raw docstring

set-domclj

(set-dom graph dom)

sets the graph to the (-> (reset-graph) (set-dom {:nodes {:d {:label "d"} :e {:label "c"}} :edges {[:d :e] {:label "d->e"}}}) (get-dom)) => {:nodes {:d {:label "d"}, :e {:label "c"}}, :edges {[:d :e] {:label "d->e"}}}

sets the graph to the 
(-> (reset-graph)
    (set-dom {:nodes {:d {:label "d"}
                      :e {:label "c"}}
              :edges {[:d :e] {:label "d->e"}}})
    (get-dom))
=> {:nodes {:d {:label "d"},
            :e {:label "c"}},
   :edges {[:d :e] {:label "d->e"}}}
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close