24 lines
599 B
Clojure
24 lines
599 B
Clojure
(ns mailhead.visualize
|
|
(:use [tangle.core])
|
|
(:require [mailhead.parser :as parser]))
|
|
|
|
(defn nodes [receive-path] [:a :b :c])
|
|
|
|
(defn edges [receive-path] [[:a :b {:label "200ms"}]
|
|
[:b :c {:label "50min"}]])
|
|
|
|
(defn draw-path [receive-path]
|
|
(-> (graph->dot
|
|
(nodes receive-path)
|
|
(edges receive-path)
|
|
{:node {:shape :box}
|
|
:directed? true
|
|
:graph {:rankdir :LR}})
|
|
(dot->image "png")))
|
|
|
|
(defn draw [filename]
|
|
(draw-path (parser/parse-from-file filename)))
|
|
|
|
(draw "/home/aaron/workbench/clojurecup2015/sample-data/header1.eml")
|
|
|