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);
$output = $d3->force_directed_graph(); #output is hash reference
$d3 = new Graph::D3(graph => $g, type => json);
$json = $d3->force_directed_graph(); # 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 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) to have different length
of edge.
AUTHOR
Shohei Kameda <
[email protected]>
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