Add arrows

This commit is contained in:
Aaron Fischer 2015-12-06 00:46:25 +01:00
parent 77da1bf687
commit 90891ab60d

View file

@ -2,14 +2,19 @@
(:use [tangle.core])
(: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"}]
["servera" "target" {:label "50min" :fillcolor "gray" :color "gray"}]])
(defn edges [path]
(let [p (map #(concat % [{:label "ms" :fillcolor "gray" :color "gray"}]) (edge-path path))]
(into [] (map #(into [] %)) p)))
(defn draw-path [receive-path]
(-> (graph->dot
(nodes receive-path)
[]
(edges receive-path)
{:node {:shape :box
:fontname "Arial"