{-| Module : FiniteCategories Description : An example of 'CompositionGraph' exported with GraphViz. Copyright : Guillaume Sabbagh 2022 License : GPL-3 Maintainer : guillaumesabbagh@protonmail.com Stability : experimental Portability : portable An example of 'CompositionGraph' exported with GraphViz. Examples of other categories transformed into 'CompositionGraph's are also exported. A random example of 'CompositionGraph' is also exported. A 'CompositionGraph' created from a string is also exported. Export the categories in the directory "OutputGraphViz\/Examples\/FiniteCategories\/CompositionGraph". -} module Math.FiniteCategories.CompositionGraph.Example ( main ) where import qualified Data.WeakSet as Set import Data.WeakSet.Safe import Data.WeakMap.Safe import Math.FiniteCategory import Math.Categories import Math.FiniteCategories import Math.IO.FiniteCategories.ExportGraphViz import Math.IO.PrettyPrint import System.Random import Numeric.Natural -- | An example of 'CompositionGraph' exported with GraphViz. main :: IO () main = do putStrLn "Start of Math.FiniteCategories.CompositionGraph.Example" catToPdf (unsafeCompositionGraph (unsafeGraph (set [1 :: Int,2,3]) (set [Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'},Arrow{sourceArrow=1,targetArrow=2,labelArrow='b'},Arrow{sourceArrow=2,targetArrow=3,labelArrow='c'}])) (weakMap [([Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'},Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}],[Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}])])) "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/CompositionGraph" diagToPdf2 (finiteCategoryToCompositionGraph (ens.(Set.powerSet).set $ "AB")) "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/EnsToCompositionGraph" diagToPdf2 (finiteCategoryToCompositionGraph (numberCategory 4)) "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/NumberCategoryToCompositionGraph" catToPdf (fst.defaultConstructRandomCompositionGraph $ (mkStdGen 123456)) "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/RandomCompositionGraph" diagToPdf2 (fst.defaultConstructRandomDiagram $ (mkStdGen 12345678)) "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/RandomDiagram" let (Right cg) = readCGString "A -f-> B -g-> C = A -h-> C" catToPdf cg "OutputGraphViz/Examples/FiniteCategories/CompositionGraph/CompositionGraphFromString" putStrLn "End of Math.FiniteCategories.CompositionGraph.Example"