dotparse-0.0.1: dot language parsing and printing.
Safe HaskellNone
LanguageHaskell2010

DotParse.Examples

Contents

Description

Examples of conversion from dot ByteStrings

Synopsis

Documentation

>>> import DotParse
>>> import Data.Proxy
>>> :set -XOverloadedStrings

examples

ex0 :: ByteString Source #

minimal definition

>>> runDotParser ex0 :: Graph
Graph {strict = Last {getLast = Just NoMergeEdges}, directed = Last {getLast = Just UnDirected}, graphid = Last {getLast = Nothing}, nodeAttributes = fromList [], graphAttributes = fromList [], edgeAttributes = fromList [], globalAttributes = fromList [], nodes = [], edges = [], subgraphs = []}
>>> testDotParser (Proxy :: Proxy Graph) defaultDotConfig ex0

ex1 :: ByteString Source #

Examples from https://renenyffenegger.ch/notes/tools/Graphviz/examples/index

>>> testDotParser (Proxy :: Proxy Graph) defaultDotConfig ex1

ex2 :: ByteString Source #

>>> testDotParser (Proxy :: Proxy Graph) defaultDotConfig ex2

ex3 :: ByteString Source #

>>> testDotParser (Proxy :: Proxy Graph) defaultDotConfig ex3

testAll :: IO () Source #

Test all the examples

svgAll :: IO () Source #

Render all the examples

exGInt :: Graph Int Source #

algebraic graph example

exInt :: Graph Source #

exInt = defaultGraph & addStatements (toStatements Directed (packUTF8 . show <$> exGInt))
import qualified Data.ByteString.Char8 as B
g <- processGraph exInt
B.putStrLn $ dotPrint g

digraph { graph [bb="0,0,495.65,493.78";overlap=false;size="1!";splines=spline] node [height=0.5;label="N";shape=circle] edge [arrowsize=0] 0 [pos="384.5,475.78";width=0.5] 1 [pos="357.5,401.63";width=0.5] 0 -> 1 [pos="e,363.57,418.85 378.51,458.77 374.1,446.99 368.12,431.02 363.67,419.13"] 6 [pos="411.5,401.63";width=0.5] 0 -> 6 [pos="e,405.43,418.85 390.49,458.77 394.9,446.99 400.87,431.02 405.32,419.13"] 12 [height=0.55967;pos="467.5,401.63";width=0.55967] 0 -> 12 [pos="e,452.8,415.41 397.83,463.19 412.75,450.22 436.85,429.27 452.43,415.73"] 2 [pos="330.5,325.33";width=0.5] 1 -> 2 [pos="e,336.35,342.42 351.64,384.51 347.15,372.14 340.97,355.15 336.45,342.72"] 7 [pos="384.5,325.33";width=0.5] 1 -> 7 [pos="e,378.65,342.42 363.36,384.51 367.85,372.14 374.03,355.15 378.54,342.72"] 13 [height=0.55967;pos="440.5,325.33";width=0.55967] 1 -> 13 [pos="e,425.95,339.36 370.47,389.02 385.4,375.66 409.87,353.75 425.58,339.69"] 3 [pos="263.5,249.04";width=0.5] 2 -> 3 [pos="e,275.26,263.08 318.83,311.39 306.7,297.94 287.81,277 275.55,263.4"] 8 [pos="419.5,249.04";width=0.5] 2 -> 8 [pos="e,406.15,261.18 344.02,313.05 360.71,299.11 388.95,275.54 405.75,261.51"] 14 [height=0.55967;pos="475.5,249.04";width=0.55967] 2 -> 14 [pos="e,459.28,261.56 344.39,313.55 348.48,310.63 353.06,307.61 357.5,305.19 394.93,284.71 408.73,289.04 446.5,269.19 450.64,267.01 454.93, 264.4 458.9,261.81"] 18 [height=0.55967;pos="239.5,96.445";width=0.55967] 2 -> 18 [pos="e,221.18,105.3 313.92,317.87 277.75,302.66 192.9,260.73 166.5,192.89 160,176.2 158.52,168.63 166.5,152.59 177.74,130.02 203.11,114.24 220.76,105.5"] 19 [height=0.55967;pos="335.5,96.445";width=0.55967] 2 -> 19 [pos="e,335.94,116.84 331.52,307.33 332.98,282.28 335.56,234 336.5,192.89 336.91,174.98 336.66,170.5 336.5,152.59 336.39,140.81 336.16, 127.62 335.94,117.09"] 4 [pos="101.5,172.74";width=0.5] 3 -> 4 [pos="e,117.56,181.11 247.37,240.64 216.44,226.46 149.09,195.57 117.92,181.27"] 9 [pos="193.5,172.74";width=0.5] 3 -> 9 [pos="e,205.67,186.66 251.62,235.43 238.93,221.96 218.89,200.69 205.97,186.98"] 15 [height=0.55967;pos="287.5,172.74";width=0.55967] 3 -> 15 [pos="e,281.6,192.01 268.82,231.55 272.58,219.93 277.61,204.35 281.51,192.29"] 5 [pos="48.498,96.445";width=0.5] 4 -> 5 [pos="e,58.506,111.47 91.279,157.42 81.908,144.28 68.101,124.92 58.727,111.78"] 10 [height=0.55967;pos="104.5,96.445";width=0.55967] 4 -> 10 [pos="e,103.72,116.67 102.19,154.51 102.65,143.28 103.24,128.61 103.71,116.95"] 16 [height=0.55967;pos="162.5,96.445";width=0.55967] 4 -> 16 [pos="e,150.12,112.52 112.69,158.11 123.2,145.31 138.91,126.18 149.86,112.83"] 5 -> 0 [pos="e,366.23,475.02 49.439,114.6 50.887,142.55 53.498,199.64 53.498,248.04 53.498,326.33 53.498,326.33 53.498,326.33 53.498,464.3 295.89, 474.85 365.82,475.02"] 11 [height=0.54162;pos="19.498,20.148";width=0.54162] 5 -> 11 [pos="e,26.284,38.534 42.206,79.323 37.545,67.382 31.197,51.119 26.397,38.823"] 17 [height=0.55967;pos="77.498,20.148";width=0.55967] 5 -> 17 [pos="e,70.506,39.061 54.791,79.323 59.386,67.552 65.62,51.579 70.394,39.349"] 15 -> 18 [pos="e,250.12,113.89 276.85,155.25 268.95,143.04 258.24,126.45 250.31,114.18"] 15 -> 19 [pos="e,324.88,113.89 298.15,155.25 306.04,143.04 316.76,126.45 324.69,114.18"] 18 -> 3 [pos="e,260.79,231.06 242.53,116.49 247.24,145.99 256.21,202.31 260.74,230.72"] 19 -> 3 [pos="e,277.53,237.38 334.82,116.79 333.41,136.85 329.16,168.62 316.5,192.89 307.11,210.88 290.05,227.04 277.82,237.15"] }