NAME
Set::SegmentTree::Builder - Builder for Segment Trees in Perl
SYNOPSIS
use Test::More;
my $builder = Set::SegmentTree::Builder->new(
@segment_list,
{option => ovalue}
);
$builder->insert([ start, end, segment_name ], [ ... ]);
isa_ok $builder->build(), 'Set::SegmentTree';
$builder->to_file('filename');
DESCRIPTION
wat? Segment Tree
In the use case where
1) you have a series of potentially overlapping segments 1) you need to know which segments encompass any particular value 1) the access pattern is almost exclusively read biased 1) need to shift between pre-built segment trees
The Segment Tree data structure allows you to resolve any single value to the list of segments which encompass it in O(log(n)+nk)
SUBROUTINES/METHODS
- new
-
constructor for a new builder accepts a list of segments segments are three element array refs like this [ low value, high value, string identifier ]
- insert
-
allows incremental building if you don't have them all at once
- build
-
creates a new segment tree object pass a list of intervals returns the tree object This may take quite some time!
- to_file
-
save the tree to a file Writes a google flatbuffer style file
DIAGNOSTICS
extensive logging if you construct with option { verbose => 1 }
CONFIGURATION AND ENVIRONMENT
Written to require very little configuration or environment
Reacts to no environment variables.
EXPORT
None
SEE ALSO
Set::FlatBuffer Data::FlatTables File::Map
INCOMPATIBILITIES
A system with variant endian maybe?
DEPENDENCIES
Google Flatbuffers
BUGS AND LIMITATIONS
Only works with FlatBuffers for serialization
Subject the limitations of Data::FlatTables
Only stores keys for you to use to index into other structures I like uuids for that.
The values for ranging are evaluated in numeric context, so using non-numerics probably won't work
LICENSE AND COPYRIGHT
Copyright (C) 2017 by David Ihnen
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.1 or, at your option, any later version of Perl 5 you may have available.
VERSION
0.01
AUTHOR
David Ihnen, <davidihnen@gmail.com>