Sample Commands


Sample commands are contained in the directories `c++-samples' and `c-samples'. The source code of them is intended to be a concrete example of the usage of this library.

dynamicBuild

This command creates an index file and then stores given records into the index file. Records to be stored are read from a record file. When the option `-c' is not set, every record in the file will be stored.
Usage: dynamicBuild [options] recordFile indexFile
Options
    -c count     set the number of records to be read from recordFile
    -d           turn on the debug mode
    -m           build the tree on memory and finally dump it to the file
    -p property  set the property of the index
    -s dataSize  set the size of data attributes (128 by default)
The property of an index file can be specified by the option `-p'. The label-value pair should be appended after the option `-p' with connecting the label and the value by the equal sign. For example, the following command will build an index whose block size is 16384.
% dynamicBuild -p HnSRTreeBlockSize=16384 recordFile indexFile

storeRecords

This command opens an existing index file and then stores given records into the index file. Records to be stored are read from a record file. When the option `-c' is not set, every record in the file will be stored.
Usage: storeRecords [options] recordFile indexFile
Options
    -c count          set the number of records to be read from recordFile
    -d                turn on the debug mode

removeRecords

This command opens an existing index file and then removes given records from the index file. Records to be removed are read from a record file. When the option `-c' is not set, every record in the file will be removed.
Usage: removeRecords [options] recordFile indexFile
Options
    -c count          set the number of records to be read from recordFile
    -d                turn on the debug mode

staticBuild

This command creates an index file for given records with the static construction method. Records to be stored are read from a record file. When the option `-c' is not set, every record in the file will be stored.
Usage: staticBuild [options] recordFile indexFile
Options
    -c count     set the number of records to be read from recordFile
    -d           turn on the debug mode
    -p property  set the property of the index
    -s dataSize  set the size of data attributes (128 by default)
The property of an index file can be specified by the option `-p'. The label-value pair should be appended after the option `-p' with connecting the label and the value by the equal sign. For example, the following command will build an index whose block size is 16384.
% staticBuild -p HnSRTreeBlockSize=16384 recordFile indexFile

fetchNN

This command opens an existing index file and then finds the nearest neighbors of a given query point. Query points are read from a record file. The search will be conducted for each point being read from the record file. The attribute values of the points contained in the record file will be ignored. When the option `-c' is not set, every record in the file will be used as a query point.
Usage: fetchNN [options] recordFile indexFile
Options
    -c count     set the number of records to be read
    -d           turn on the debug mode
    -n neighbors set the number of neighbors to be fetched (1 by default)
    -p property  set the property of the index
    -v verify    verify record existence

fetchColoredNN

(in preparation as of version 2.0 beta 1).

fetchInRect

This command opens an existing index file and then finds such a point that resides in a given (hyper)rectangle. A query rectangle is specified by the center and the width of the rectangle. The center point of a query rectangle is read from a record file, while the width of the rectangle is specified by the command line option. The search will be conducted for each point being read from the record file. The attribute values of the points contained in the record file will be ignored. When the option `-c' is not set, every record in the file will be read and used as the center of a query rectangle.
Usage: fetchInRect [options] recordFile indexFile
Options
    -c count     set the number of records to be read
    -d           turn on the debug mode
    -p property  set the property of the index
    -v verify    verify record existence
    -w width     set the width of the query rectangle (0 by default)

Record File

A record file contains point-attribute pairs. The attribute of a point is a character string.

The format of a record file is very simple. The first line of the file contains the dimensionality of contained points. From the second line to the bottom, each line corresponds to one point-attribute pair. A line consists of multiple fields, where fields are separated by colon. The coordinates of a point are filled from the beginning of the line. The remainder of the line is the attribute of the point.

For example, the following file contains four 2-dimensional points. The coordinates of them are (11, 12), (21, 22), (31, 32), and (41, 42), while the attributes of them are ``one'', ``two'', ``three'', and ``four'', respectively.

2        
11:12:one  
21:22:two  
31:32:three
41:42:four 

[TOC] [Library] [Classes] [Commands] [Examples] [References]

Any feedback is appreciated (corrections, suggestions, etc.).

Norio KATAYAMA <katayama@nii.ac.jp>