Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 468a8778 authored by Vincent Danjean's avatar Vincent Danjean
Browse files

ajout de nanova.pm

git-svn-id: svn+ssh://imag/users/huron/danjean/svnroot/claire/altree/trunk@201 cf695345-040a-0410-a956-b889e835fe2e
parent 2787d61e
No related branches found
No related tags found
No related merge requests found
package ALTree::Nanova;
use strict;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
#$VERSION = 1.00;
# if using RCS/CVS, this may be preferred
#$VERSION = do { my @r = (q$Revision: 153 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@ISA = qw(Exporter);
@EXPORT = qw(); #(&func1 &func2 &func4);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw();
}
use vars @EXPORT_OK;
use ALTree::Utils qw(erreur);
use Data::Dumper;
# This function transforms the tree structure into the matrix used by the library NAnova
sub Tree2mat
{
my $present_node = shift;
my $vect = shift; # structure transitoire: chemin de la racine une feuille
my $mat = shift; # The matrix which is filled by the function
if ($present_node->NbChildren()==0) {
push (@{$mat}, $vect);
} else {
my $number=0;
for my $child ($present_node->GetChildrenList()) {
push(@{$vect}, $number);
$number ++;
Tree2mat($present_node, $vect, $mat);
}
}
}
sub WriteMat
{
my $mat = shift;
for (my $i=0; $i<=$#$mat; $i++) {
foreach my $elem (@{$mat->[$i]}) {
print $elem, "\t";
}
print "\n";
}
}
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment