HTML::InfoVis::Graph - Generate a JSON structure suitable for loadJSON classes
use HTML::InfoVis; my $graph = HTML::InfoVis::Graph->new; $graph->add_edge( 'foo' => 'bar' ); print "var json = " . $graph->as_json . "\n";
This is a basic first implementation, designed to prove the concept of converting Perl graphs into InfoVis graphs.
It provides a few Graph-like methods to populate the graph, and a single method for generating an anonymous JSON structure representing the graph.
my $graph = HTML::InfoVis::Graph->new( Graph->new, );
The default constructor takes a single optional param of a Graph object that represents the graph structure.
Returns a new HTML::InfoVis::Graph object.
$graph->add_node( 'foo' );
add_node method is a pass-through method to the underlying Graph
$graph->add_edge( 'foo' => 'bar' );
add_edge method is a pass-through method to the underlying Graph
my $json = $graph->as_json;
as_json method generates a serialized anonymous JSON structure that represents the graph in a form suitable for loading by any InfoVis
Bugs should be reported via the CPAN bug tracker at
For other issues, or commercial enhancement or support, contact the author.
Adam Kennedy <email@example.com>
Copyright 2009 - 2012 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.