Graphalyze- Graph-Theoretic Analysis library.

Copyright(c) Ivan Lazar Miljenovic 2009
License2-Clause BSD
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.




class DocumentGenerator dg where Source #

Represents the class of document generators.

Minimal complete definition

createDocument, docExtension


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

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

docExtension :: dg -> String Source #

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

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.




data VisParams Source #

Defines the parameters used for creating visualisations of graphs.




Helper functions

Utility functions to help with document creation.

addLegend :: FilePath -> FilePath -> VisProperties -> Document -> IO Document Source #

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

today :: IO String Source #

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 Bool Source #

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

createGraph Source #


:: 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 -> GraphSize Source #

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

unDotPath :: FilePath -> FilePath Source #

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