summaryrefslogtreecommitdiff
path: root/lib/Graph
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-06-03 14:47:02 +0200
committerfranck cuny <franck@lumberjaph.net>2011-06-03 14:47:02 +0200
commit8680309d434d848f77ac30d132f1fbca7f9f1230 (patch)
tree8c4bdeb045f8c12e1954bd6ceb34312d7dceb497 /lib/Graph
parentFix #2 - support viz elements (diff)
downloadgraph-gexf-8680309d434d848f77ac30d132f1fbca7f9f1230.tar.gz
attributes are chained
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to '')
-rw-r--r--lib/Graph/GEXF/Node.pm43
1 files changed, 39 insertions, 4 deletions
diff --git a/lib/Graph/GEXF/Node.pm b/lib/Graph/GEXF/Node.pm
index 0d691b7..8f8187a 100644
--- a/lib/Graph/GEXF/Node.pm
+++ b/lib/Graph/GEXF/Node.pm
@@ -9,8 +9,18 @@ with
'Graph::GEXF::Role::Viz::Size' => { as => 'size' },
'Graph::GEXF::Role::Viz::Shape' => { for => 'node' };
-has id => (is => 'ro', isa => 'Str', required => 1);
-has label => (is => 'rw', isa => 'Str');
+has id => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+ traits => ['Chained']
+);
+
+has label => (
+ is => 'rw',
+ isa => 'Str',
+ traits => ['Chained']
+);
has edges => (
traits => ['Hash'],
@@ -71,7 +81,7 @@ no Moose;
my $graph = Graph::GEXF->new();
- my $n = $graph->add_node;
+ my $n = $graph->add_node();
=head1 DESCRIPTION
@@ -91,6 +101,32 @@ The B<id> of a node can't be changed once the node is created.
Each node has a label. If the B<label> is not defined, the default value is the B<id>. This value can be changed at any time.
+=head3 viz
+
+If B<visualization> is set to true, thoses values will be added to the XML.
+
+=over
+
+=item r,g,b,a
+
+ $n->r(255);
+
+=head3 x,y,z
+
+ $n->x(1);
+
+=head3 shape
+
+ $n->shape('disc');
+
+can be any of B<disc>, B<square>, B<triangle>, B<diamond>.
+
+=head3 size
+
+ $n->size(2);
+
+=back
+
=head2 METHODS
=head3 link_to
@@ -117,4 +153,3 @@ This method will create an edge between some nodes.
=head3 get_edge
-=head3