1 # This file is part of the DEPS/graph-includes package
3 # (c) 2005,2006 Yann Dirson <ydirson@altern.org>
4 # Distributed under version 2 of the GNU GPL.
6 package graphincludes
::renderer
::tulip
;
11 use base
qw(graphincludes::renderer);
12 use Hash
::Util
qw(lock_keys);
14 use graphincludes
::params
;
20 bless ($self, $class);
27 my ($graphnode, $nodestylers, $edgestylers) = @_;
28 my $graph = eval { defined $graphnode->{DATA
} } ?
$graphnode->{DATA
} : $graphnode;
30 # give unique numeric IDs to nodes, starting at 1
35 foreach my $node ($graph->get_nodes) {
36 my $label = $node->{LABEL
};
37 unless (defined $nodeids{$label}) {
39 $nodeids{$label} = $nodecount;
46 for (my $i=1; $i<=$nodecount; $i++) {
53 print "(property 0 string \"viewLabel\"\n";
54 print " (default \"\" \"\" )\n";
55 foreach my $node (keys %nodeids) {
56 print " (node $nodeids{$node} \"$node\")\n";
65 foreach my $file ($graph->get_edge_origins) {
66 foreach my $dest ($graph->get_dep_names_from($file)) {
68 print "(edge $edgecount ", $nodeids{$file}, ' ', $nodeids{$dest}, ")\n";