dotparse-0.1.0.0: dot language parsing and printing.
Safe HaskellSafe-Inferred
LanguageGHC2021

DotParse.Examples

Contents

Description

Examples of conversion from dot ByteStrings

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

Synopsis

Documentation

>>> import DotParse
>>> import Data.Proxy
>>> :set -XOverloadedStrings
>>> import Data.String.Interpolate
>>> import qualified Data.ByteString.Char8 as Char8
>>> import Optics.Core
>>> import Chart

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

testAll :: IO () Source #

Test all the examples

svgAll :: IO () Source #

Render all the examples

exAGraph :: Graph Int Source #

algebraic graph example

exGraph = defaultGraph & addStatements (toStatements Directed (Char8.pack . show <$> exAGraph))
exGraphAugmented <- processGraph exGraph
writeChartOptions "other/exga.svg" (graphToChart exGraphAugmented)