logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Author

       Shohei Kameda <shoheik@cpan.org>

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.

License

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

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_bundlinghttp://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).

Name

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

See Also

perl v5.34.0                                       2022-06-14                                     Graph::D3(3pm)

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

See Also