Skip to content

luborliu/TraClusAlgorithm

Repository files navigation

TraClus Algorithm

This is an implementation of TraClus (TRAjectory CLUStering) [1] algorithm in Java. A GUI was added for the convenience.

The original paper of this algorithm can be found at http://hanj.cs.illinois.edu/pdf/sigmod07_jglee.pdf The authors of the paper implemented the algorithm in C++, so it could be helpful to develop one in Java for other users to use. I have compared the output with the one generated by the C++ implementation, so far I have not found any bugs. It will be great if any one reports any bugs about this implementation.

I am currently involved in a maritime traffic project which requires me to implement various clustering algorithms. So that is the very first motivation about why I do this implementation. I also implemented another clustering algorithm called DBSCANSD which was proposed during my thesis study and you can find its code from the follwoing link: https://github.com/luborliu/DBSCANSD

How to run the code?

After downloading it to local,

  1. cd to the folder of src/boliu/

  2. compile all the .java files using:

    javac *.java

  3. cd to the folder of src/

  4. execute the program using the following either command:

    1. java boliu.Main inputfile outputfile

      --e.g. java boliu.Main deer_1995.tra testOut.txt

      In this way, the program will help you to decide the parameters for eps and minLns;

    2. java boliu.Main inputfile outputfile eps minLns

      --e.g. java boliu.Main deer_1995.tra testOut.txt 29 8

      In this way, you tell the program the parameters for eps and minLns, which are 29 and 8 separately.

  5. waiting for the result :)

  6. Star it if it helps *-*

Input file format

The data format is as follows:

1st line: Number of dimensions (2 for example)

2nd line: Number of trajectories (32 for example)

3rd line: Trajectory Index (starting from 0, so 0 for this line), Number of trajectory points in this trajectory (n for example), X1, Y1, X2, Y2, …., Xn, Yn

4th line: Trajectory Index (starting from 0, so 1 for this line), Number of trajectory points in this trajectory (m for example), X1, Y1, X2, Y2, …., Xm, Ym
.
.
.
34th line:Trajectory Index (starting from 0, so 31 for this line), Number of trajectory points in this trajectory (j for example), X1, Y1, X2, Y2, …., Xj, Yj

Reference

[1] Lee, Jae-Gil, Jiawei Han, and Kyu-Young Whang. "Trajectory clustering: a partition-and-group framework." Proceedings of the 2007 ACM SIGMOD international conference on Management of data. ACM, 2007.

Realse Note

02/23/2017 Create License file under MIT license as requested.

03/10/2016 Fix a bug (reported by @luca-zamboni) that will throw InputMismatchException while the code is downloaded in some countries.

02/02/2016 Fix a bug (reported by Dieter) of estimation function (cannot give right output according to different input files).

11/25/2015 Fix a bug (reported by @ankushdas) that makes the program not work for multi-dimensional (>2) data set.

About

This is an implementation for TraClus algorithm in Java. A GUI was added.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages