Algorithm::Tree::NCA 0.01
Sponsored Links
Algorithm::Tree::NCA 0.01 Ranking & Summary
File size:
0.010 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
827
Date added:
2007-07-20
Publisher:
Mats Kindahl
Algorithm::Tree::NCA 0.01 description
Algorithm::Tree::NCA is a constant time retrieval of nearest common ancestor.
SYNOPSIS
use Algorithm::Tree::NCA;
my $tree = ...;
my $nca = new Algorithm::Tree::NCA(-tree => $tree);
my $x = $tree->get_node(...);
my $y = $tree->get_node(...);
my $z = $nca->nca($x,$y);
This package provides constant-time retrieval of the Nearest Common Ancestor (NCA) of nodes in a tree. The implementation is based on the algorithm by Harel and which can, after linear-time preprocessing, retrieve the nearest common ancestor of two nodes in constant time.
To implement the algorithm it is necessary to store some data for each node in the tree.
- A node number assigned to the node in a pre-order fashion
- A number to identify the run of the node ("ALGORITHM")
- The leader for each run, which should be retrievable through its node number
- A magic number ("ALGORITHM")
- The parent node for each node
- The maximum number assigned to a any node in the subtree
All data above, with the exception of the node number, is stored in an array inside the Algorithm::Tree::NCA object.
The node number has to be stored in the actual tree node in some manner (alternative solutions would be to slow to give constant-time retrieval), which requires a set method and a get method for the nodes. Since the most common case is using hashes to represent nodes, there are default implementations of the set and get methods.
The default set method is:
sub _set_method {
my($node,$value) = @_;
$node->{_nca_number} = $value;
}
and the default get method is:
sub _get_method {
my($node) = @_;
return $node->{_nca_number};
}
If have chosen another representation of your nodes, you can provide alternative set and get methods by using the -set and -get options when creating the Algorithm::Tree::NCA object.
SYNOPSIS
use Algorithm::Tree::NCA;
my $tree = ...;
my $nca = new Algorithm::Tree::NCA(-tree => $tree);
my $x = $tree->get_node(...);
my $y = $tree->get_node(...);
my $z = $nca->nca($x,$y);
This package provides constant-time retrieval of the Nearest Common Ancestor (NCA) of nodes in a tree. The implementation is based on the algorithm by Harel and which can, after linear-time preprocessing, retrieve the nearest common ancestor of two nodes in constant time.
To implement the algorithm it is necessary to store some data for each node in the tree.
- A node number assigned to the node in a pre-order fashion
- A number to identify the run of the node ("ALGORITHM")
- The leader for each run, which should be retrievable through its node number
- A magic number ("ALGORITHM")
- The parent node for each node
- The maximum number assigned to a any node in the subtree
All data above, with the exception of the node number, is stored in an array inside the Algorithm::Tree::NCA object.
The node number has to be stored in the actual tree node in some manner (alternative solutions would be to slow to give constant-time retrieval), which requires a set method and a get method for the nodes. Since the most common case is using hashes to represent nodes, there are default implementations of the set and get methods.
The default set method is:
sub _set_method {
my($node,$value) = @_;
$node->{_nca_number} = $value;
}
and the default get method is:
sub _get_method {
my($node) = @_;
return $node->{_nca_number};
}
If have chosen another representation of your nodes, you can provide alternative set and get methods by using the -set and -get options when creating the Algorithm::Tree::NCA object.
Algorithm::Tree::NCA 0.01 Screenshot
Algorithm::Tree::NCA 0.01 Keywords
NCA
NCA 0.01
Ancestor
Nearest common ancestor
Common ancestor
Constant time
node number
node
number
common
retrieval
nearest
method
Algorithm::Tree::NCA
AlgorithmTreeNCA
Algorithm::Tree::NCA 0.01
Bookmark Algorithm::Tree::NCA 0.01
Algorithm::Tree::NCA 0.01 Copyright
WareSeeker periodically updates pricing and software information of Algorithm::Tree::NCA 0.01 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Algorithm::Tree::NCA 0.01 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
last universal common ancestor
Lowest common ancestor
numbersusa
common ancestors
common ancestor of humans
constant time delay
phone numbers
most recent common ancestor
number 23
numbers
node 32
last common ancestor
constant time delay procedure
number games
reverse number lookup
commonwealth of virginia
nearest common ancestors
lymph nodes
Related Software
Algorithm::Merge is a Perl module package that provides three-way merge and diff. Free Download
mcl-algorithm is a scalable cluster algorithm for graphs based on stochastic flow. Free Download
Algorithm::AhoCorasick provides efficient search for multiple strings. Free Download
Algorithm::SocialNetwork is a social network analysis. Free Download
AI::Menu is a Perl object that generates Tree::Nary objects from directed graphs or a description of the function set. Free Download
ElegantJ Trees Bean package contains a feature-rich tree for hierarchical representation of data. Free Download
Algorithm::Numerical::Sample is a Perl module that can draw samples from a set. Free Download
Lisp::Fmt is a Perl module for Common Lisp like formatting. Free Download
Latest Software
Popular Software
Favourite Software