Add arrows
This commit is contained in:
parent
77da1bf687
commit
90891ab60d
1 changed files with 9 additions and 4 deletions
|
@ -2,14 +2,19 @@
|
||||||
(:use [tangle.core])
|
(:use [tangle.core])
|
||||||
(:require [mailhead.parser :as parser]))
|
(:require [mailhead.parser :as parser]))
|
||||||
|
|
||||||
(defn nodes [receive-path] ["home" "servera" "target"])
|
(defn edge-path [receive-path]
|
||||||
|
(let [path (reverse receive-path)
|
||||||
|
chain (concat (map :sender (butlast path)) [(:receiver (last path))])
|
||||||
|
cleaned-chain (map clojure.string/lower-case chain)]
|
||||||
|
(partition 2 (interleave cleaned-chain (rest cleaned-chain)))))
|
||||||
|
|
||||||
(defn edges [receive-path] [["home" "servera" {:label "200ms" :fillcolor "gray" :color "gray"}]
|
(defn edges [path]
|
||||||
["servera" "target" {:label "50min" :fillcolor "gray" :color "gray"}]])
|
(let [p (map #(concat % [{:label "ms" :fillcolor "gray" :color "gray"}]) (edge-path path))]
|
||||||
|
(into [] (map #(into [] %)) p)))
|
||||||
|
|
||||||
(defn draw-path [receive-path]
|
(defn draw-path [receive-path]
|
||||||
(-> (graph->dot
|
(-> (graph->dot
|
||||||
(nodes receive-path)
|
[]
|
||||||
(edges receive-path)
|
(edges receive-path)
|
||||||
{:node {:shape :box
|
{:node {:shape :box
|
||||||
:fontname "Arial"
|
:fontname "Arial"
|
||||||
|
|
Loading…
Reference in a new issue