Graphalyze- Graph-Theoretic Analysis library.
Safe HaskellNone




This module defines the report framework used.


Document representation

Document is the simplified representation of a document. Note that this just specifies a document layout, and not an implementation. To actually create a "physical" document, you must use an instance of DocumentGenerator.

data Document Source

Representation of a document. The document is to be stored in the directory rootDirectory, and the main file is to have a filename of fileFront <.> (docExtension dg), where dg is an instance of DocumentGenerator.




rootDirectory :: FilePath

Document location

fileFront :: String
graphDirectory :: FilePath

The sub-directory of rootDirectory, where graphs are to be created.

title :: DocInline


author :: String
date :: String
legend :: [(Either DocGraph DocInline, DocInline)]


content :: [DocElement]

class DocumentGenerator dg whereSource

Represents the class of document generators.


createDocument :: dg -> Document -> IO (Maybe FilePath)Source

Convert idealised Document values into actual documents, returning the document file created.

docExtension :: dg -> StringSource

The extension of all document-style files created. Note that this doesn't preclude the creation of other files, e.g. images.

data Location Source

Representation of a location, either on the internet or locally.


Web String 
File FilePath 

data GraphSize Source

Specify the size the DotGraph should be at.


GivenSize GraphSize

Specify the maximum size to use.


Let GraphViz choose an appropriate size.

data DocGraph Source

Specify the DotGraph to turn into an image, its filename (sans extension) and its caption. The DotGraph should not have a Size set.




imageFile :: FilePath

What name to provide the image file (without an extension).

description :: DocInline
dotGraph :: DotGraph Node

data VisParams Source

Defines the parameters used for creating visualisations of graphs.




rootDir :: FilePath

Root directory of the document.

graphDir :: FilePath

Image sub-directory.

defaultImage :: VisProperties

The default visualisation.

largeImage :: Maybe VisProperties

If Just vp', then a larger visualisation is linked to from the default one.

saveDot :: Bool

Should the Dot source code be saved as well?

data VisProperties Source

A specification on how to visualise a DocGraph.



Helper functions

Utility functions to help with document creation.

addLegend :: FilePath -> FilePath -> VisProperties -> Document -> IO DocumentSource

Create the legend section and add it to the document proper.

today :: IO StringSource

Return today's date as a string, e.g. "Monday 1 January, 2000". This arbitrary format is chosen as there doesn't seem to be a way of determining the correct format as per the user's locale settings.

tryCreateDirectory :: FilePath -> IO BoolSource

Attempts to create the specified directly, returning True if successful (or if the directory already exists), False if an error occurred.



:: VisParams

Visualisation parameters.

-> DocGraph 
-> IO DocElement 

Attempts to create image files (with the given filename in the given directory) from the graph. If the second VisProperties not Nothing, then the first image links to the second. The whole result is wrapped in a Paragraph. unDotPath is applied to the filename in the DocGraph.

If saveDot is true, then it is assumed that the format isn't Canon, DotOutput or XDot (because of filename clashes).

createSize :: Double -> GraphSizeSource

Using a 6:4 ratio, create the given Point representing width,height from the width.

unDotPath :: FilePath -> FilePathSource

Replace all . with - in the given FilePath, since some output formats (e.g. LaTeX) don't like extraneous .'s in the filename.