Algorithm-DBSCAN
view release on metacpan or search on metacpan
lib/Algorithm/DBSCAN.pm view on Meta::CPAN
my $self = {};
$self->{dataset_object} = $dataset;
$self->{dataset} = $dataset->{points};
@{$self->{id_list}} = keys %{$dataset->{points}};
$self->{eps} = $eps;
$self->{min_points} = $min_points;
$self->{current_cluster} = 1;
$self->{use_external_region_index} = 0;
bless($self, $type);
return($self);
}
=head2 FindClusters
The main method that will run the DBSCAN algorithm on the Dataset.
=cut
lib/Algorithm/DBSCAN/Dataset.pm view on Meta::CPAN
package Algorithm::DBSCAN::Dataset;
sub new {
my($type) = @_;
my $self = {};
$self->{points} = {};
bless($self, $type);
return($self);
}
sub AddPoint {
my ($self, $point) = @_;
my $nb_points = scalar(keys %{$self->{points}});
$point->{visited} = 0;
$point->{id} = $nb_points;
lib/Algorithm/DBSCAN/Point.pm view on Meta::CPAN
sub new {
my($type, $point_id, @coordinates) = @_;
my $self = {};
$self->{cluster_id} = 0;
$self->{point_id} = $point_id;
$self->{coordinates} = \@coordinates;
bless($self, $type);
return($self);
}
sub Distance {
my ($self, $point) = @_;
my $distance;
my $i = 0;
( run in 2.146 seconds using v1.01-cache-2.11-cpan-de7293f3b23 )