1-- | Dump a directed graph in dot format. Used for debugging purposes
3module Hakyll.Core.DirectedGraph.Dot
8import Hakyll.Core.DirectedGraph
9import qualified Data.Set as S
11-- | Convert a directed graph into dot format for debugging purposes
14 => (a -> String) -- ^ Convert nodes to dot names
15 -> DirectedGraph a -- ^ Graph to dump
16 -> String -- ^ Resulting string
17toDot showTag graph = unlines $ concat
18 [ return "digraph dependencies {"
19 , map showNode (S.toList $ nodes graph)
20 , concatMap showEdges (S.toList $ nodes graph)
24 showNode node = " \"" ++ showTag node ++ "\";"
25 showEdges node = map (showEdge node) $ S.toList $ neighbours node graph
26 showEdge x y = " \"" ++ showTag x ++ "\" -> \"" ++ showTag y ++ "\";"
28-- | Write out the @.dot@ file to a given file path. See 'toDot' for more
31writeDot :: Ord a => FilePath -> (a -> String) -> DirectedGraph a -> IO ()
32writeDot path showTag = writeFile path . toDot showTag
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list