NAME

Graph::D3 - Create ref/json to show node-edge graph with D3.js

SYNOPSIS

use Graph;
use Graph::D3;
my $g = new Graph(
    vertices => [qw/1 2 3 4 5/], 
    edges => [[qw/1 2/], [qw/2 3/], [qw/3 5/], [qw/4 1/]] 
);
my $d3 = new Graph::D3(graph => $g);
my $output = $d3->force_directed_graph(); #output is hash reference
$output = $d3->hierarchical_edge_bundling(); #output is hash reference

$d3 = new Graph::D3(graph => $g, type => json); 
my $json = $d3->force_directed_graph(); # output is json format
$json = $d3->hierarchical_edge_bundling(); # output is json format

DESCRIPTION

Graph::D3 is a moudle to covert Graph object to the format which is used in d3.js(http://d3js.org/). This module simply supports node-edge graph in the example.

METHODS

force_directed_graph

This outputs the format which is used for Force Directed Graph described below.

https://gist.github.com/mbostock/4062045,http://bl.ocks.org/mbostock/4062045

The input graph should be directed grpah. Node in Graph can have 'group' attribute (Default is all 1) to have different node color. Also Edge in Graph can have 'value' attribe(defalut is all 1).

hierarchical_edge_bundling

http://mbostock.github.io/d3/talk/20111116/bundle.html

The input graph shoudl be directed graph. Node in Graph can have 'size' attribute (Default is all 1).

AUTHOR

Shohei Kameda <shoheik@cpan.org>

COPYRIGHT

Copyright 2013- Shohei Kameda

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO