summaryrefslogtreecommitdiff
path: root/lib/Graph/GEXF/Role/XML.pm
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 /lib/Graph/GEXF/Role/XML.pm
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>
Diffstat (limited to '')
-rw-r--r--lib/Graph/GEXF/Role/XML.pm11
1 files changed, 7 insertions, 4 deletions
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;