summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-05-21 15:08:39 +0200
committerfranck cuny <franck@lumberjaph.net>2011-05-21 15:08:39 +0200
commitfa23a91b53f219ceec3fd1a601b3999dc7a26870 (patch)
tree090a420fbf583a4584f3814042cfcb2b927bb8a7
parentperltidy (diff)
downloadgraph-gexf-fa23a91b53f219ceec3fd1a601b3999dc7a26870.tar.gz
add roles for viz; update to draft 1.2; perltidy
Signed-off-by: franck cuny <franck@lumberjaph.net>
-rw-r--r--lib/Graph/GEXF/Attribute.pm2
-rw-r--r--lib/Graph/GEXF/Edge.pm6
-rw-r--r--lib/Graph/GEXF/Role/XML.pm11
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/Graph/GEXF/Attribute.pm b/lib/Graph/GEXF/Attribute.pm
index fb18ea2..3360307 100644
--- a/lib/Graph/GEXF/Attribute.pm
+++ b/lib/Graph/GEXF/Attribute.pm
@@ -10,5 +10,7 @@ has type => (
isa => enum([qw/string integer float double boolean date anyURI/])
);
+no Moose;
+
1;
diff --git a/lib/Graph/GEXF/Edge.pm b/lib/Graph/GEXF/Edge.pm
index 26f2462..a116a01 100644
--- a/lib/Graph/GEXF/Edge.pm
+++ b/lib/Graph/GEXF/Edge.pm
@@ -3,6 +3,10 @@ package Graph::GEXF::Edge;
use Moose;
use Data::UUID::LibUUID;
+with
+ 'Graph::GEXF::Role::Viz::Size' => { as => 'thickness' },
+ 'Graph::GEXF::Role::Viz::Shape' => { for => 'edge' };
+
has id => (
is => 'ro',
isa => 'Str',
@@ -15,4 +19,6 @@ has target => (is => 'ro', isa => 'Str', required => 1);
has label => (is => 'rw', isa => 'Str');
has weight => (is => 'rw', isa => 'Num', lazy => 1, default => 1);
+no Moose;
+
1;
diff --git a/lib/Graph/GEXF/Role/XML.pm b/lib/Graph/GEXF/Role/XML.pm
index b434746..47b0f52 100644
--- a/lib/Graph/GEXF/Role/XML.pm
+++ b/lib/Graph/GEXF/Role/XML.pm
@@ -7,7 +7,7 @@ use XML::Simple;
has gexf_ns => (
is => 'ro',
isa => 'Str',
- default => 'http://www.gexf.net/1.1draft'
+ default => 'http://www.gexf.net/1.2draft'
);
has gexf_version => (
@@ -49,13 +49,14 @@ sub to_xml {
}
push @{$graph->{gexf}->{graph}->{nodes}->{node}}, $node_desc;
-
+
foreach my $edge_id ($node->all_edges) {
my $edge = $node->get_edge($edge_id);
push @{$graph->{gexf}->{graph}->{edges}->{edge}},
- { id => $edges_id,
+ { id => $edge->id,
source => $edge->source,
- target => $edge->target
+ target => $edge->target,
+ weight => $edge->weight,
};
}
}
@@ -86,4 +87,6 @@ sub add_attributes {
push @{$graph->{gexf}->{graph}->{attributes}}, $attributes;
}
+no Moose::Role;
+
1;