In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see for more information.

Commit 08fdf8e0 authored by Philipp Meyer's avatar Philipp Meyer

Added output to dot files

parent 341129ab
{-# LANGUAGE OverloadedStrings #-}
module Printer.DOT
import qualified Data.ByteString.Lazy as L
import Data.ByteString.Builder
import Data.Monoid
import PetriNet
import Structure
renderNet :: PetriNet -> Builder
renderNet net =
"digraph petrinet {\n" <>
mconcat (map placeLabel (places net)) <>
mconcat (map transLabel (transitions net)) <>
placeLabel p = stringUtf8 p <> " [label=\" \"];\n"
transLabel t = stringUtf8 t <> " [label=\" \", shape=box, " <>
"style=filled, fillcolor=\"" <>
(if checkParallelT net t then "#FF0000" else "#AAAAAA") <>
"\"];\n" <>
mconcat (map (\p -> arcLabel (p,t)) (pre net t)) <>
mconcat (map (\p -> arcLabel (t,p)) (post net t))
arcLabel (a,b) = stringUtf8 a <> " -> " <> stringUtf8 b <> "\n"
printNet :: PetriNet -> L.ByteString
printNet = toLazyByteString . renderNet
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment