Graph::Undirected::Hamiltonicity::Output - convenience subroutines for printing output in various formats.


Version 0.013


The output() subroutine examines an environment variable called HC_OUTPUT_FORMAT to determine the output format. The output format can be one of:

  • 'html' : output in HTML form, with graphs embedded as inline SVG.

  • 'text' : output in text form, with graphs converted to edge-lists.

  • 'none' : do no generate any output.

    use Graph::Undirected::Hamiltonicity::Output;

    # in html mode, say "Foo<BR/>"
    # in text mode, say "Foo"
    # in none mode, print nothing.

    output($g); # $g is a Graph::Undirected
    # in html mode, print the SVG to draw this graph
    # in text mode, print the adjacency-list of this graph
    # in none mode, print nothing.

    output($g, { required => 1 });
    # Indicates that the graph should be formatted
    # as a graph of "required" edges only.


Exports the output() subroutine by default.



This subroutine produces output polymorphically, based on the state of the HC_OUTPUT_FORMAT environment variable, and on the input.

It is overloaded to output literal HTML, text stripped from HTML, and SVG embedded inline.


Ashwin Dixit, <ashwin at ownlifeful dot com>