diff options
Diffstat (limited to 'lib/Graph/GEXF.pm')
-rw-r--r-- | lib/Graph/GEXF.pm | 86 |
1 files changed, 52 insertions, 34 deletions
diff --git a/lib/Graph/GEXF.pm b/lib/Graph/GEXF.pm index 8f7d1ef..f226b06 100644 --- a/lib/Graph/GEXF.pm +++ b/lib/Graph/GEXF.pm @@ -14,12 +14,24 @@ with 'Graph::GEXF::Role::Attributes' => { for => [qw/node edge/], with_method => 1 }; +=attr visualization (B<Boolean>) + +if set to true, the generated graph will includes visualizations informations + +=cut + has visualization => ( is => 'ro', isa => 'Bool', predicate => 'has_visualization', ); +=attr graph_mode (B<static|dynamic>) + +Is your graph static or dynamic. + +=cut + has graph_mode => ( is => 'ro', isa => enum( [qw/static dynamic/] ), @@ -27,6 +39,12 @@ has graph_mode => ( default => 'static', ); +=attr edge_type (B<directed|undirected|mutual|notset>) + +The type of the edges + +=cut + has edge_type => ( is => 'ro', isa => enum( [qw/directed undirected mutual notset/] ), @@ -34,6 +52,34 @@ has edge_type => ( default => 'directed', ); +=attr nodes + +a HashRef of L<Graph::GEXF::Node> objects. + +=cut + +=method total_nodes + +Return the list of nodes attached to the graph + +=cut + +=method get_node + +Return a node + +=cut + +=method add_node_attribute($name, $type, [$default_value]) + +Add attributes to node + +=method all_nodes + +Return all the nodes + +=cut + has nodes => ( traits => ['Hash'], is => 'rw', @@ -49,6 +95,12 @@ has nodes => ( }, ); +=method add_node + +Add a new node to the graph + +=cut + sub add_node { my $self = shift; my ($id, %attributes); @@ -123,37 +175,3 @@ sub add_node { # render the graph in XML my $xml = $graph->to_xml; - -=head1 DESCRIPTION - -=head2 ATTRIBUTES - -=over 4 - -=item visualization - -If set to true, the generated graph will include visualizations informations. - -=item graph_mode - -could be B<static> or B<dynamic>. Default is B<static> - -=item edge_type - -could be B<directed>, B<undirected>, B<mutual> or B<notset>. Default is B<directed>. - -=back - -=head2 METHODS - -=over 4 - -=item add_node_attribute($name, $type, [$default_value]) - -Add attributes to node - -=item add_node([$id]) - -Add a new node to the graph - -=back |