packages feed

hgraph-1.2.0.0: src/HGraph/Undirected/Output.hs

module HGraph.Undirected.Output
  ( toDot
  )
where

import HGraph.Undirected
import Data.List

toDot g = "graph {\n  "
  ++ intercalate ";\n  " (map show $ vertices g) ++ ";\n"
  ++ intercalate ";\n  " (map (\(v,u) -> show v ++ " -- " ++ show u) $ edges g) ++ ";\n}"