Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.algorithm.result.clustering
Class ClusterOrder<O extends DatabaseObject,D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.algorithm.result.AbstractResult<O>
          extended by de.lmu.ifi.dbs.elki.algorithm.result.clustering.ClusterOrder<O,D>
Type Parameters:
O - the type of DatabaseObjects handled by this Result
D - the type of Distance used by this Result
All Implemented Interfaces:
Result<O>, Loggable

public class ClusterOrder<O extends DatabaseObject,D extends Distance<D>>
extends AbstractResult<O>

A class representing the cluster order of the OPTICS algorithm.

Author:
Elke Achtert

Field Summary
private  List<ClusterOrderEntry<D>> co
          The cluster order.
private  DistanceFunction<O,D> distanceFunction
          The distance function of the OPTICS algorithm.
private  D maxReachability
          The maximum reachability in this cluster order.
 
Fields inherited from class de.lmu.ifi.dbs.elki.algorithm.result.AbstractResult
db, FILE_EXTENSION
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Fields inherited from interface de.lmu.ifi.dbs.elki.algorithm.result.Result
SEPARATOR
 
Constructor Summary
ClusterOrder(Database<O> database, DistanceFunction<O,D> distanceFunction)
          Provides the cluster order of the OPTICS algorithm.
 
Method Summary
 void add(Integer objectID, Integer predecessorID, D reachability)
          Adds an object with the given predecessor and the given reachability to this cluster order.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 D getMaxReachability()
          Returns the maximum reachability in this cluster order.
 int hashCode()
          Returns a hash code value for the object.
 Iterator<ClusterOrderEntry<D>> iterator()
          Returns an iterator over the elements in this cluster order in proper sequence.
 void output(File out, Normalization<O> normalization, List<AttributeSettings> settings)
          Writes the clustering result to the given file.
 void output(PrintStream outStream, Normalization<O> normalization, List<AttributeSettings> settings)
          Writes the clustering result to the given stream.
 int size()
          Returns the size of this cluster order.
 String toString()
          Returns a string representation of this cluster order.
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.result.AbstractResult
getDatabase, writeHeader
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

distanceFunction

private final DistanceFunction<O extends DatabaseObject,D extends Distance<D>> distanceFunction
The distance function of the OPTICS algorithm.


co

private final List<ClusterOrderEntry<D extends Distance<D>>> co
The cluster order.


maxReachability

private D extends Distance<D> maxReachability
The maximum reachability in this cluster order.

Constructor Detail

ClusterOrder

public ClusterOrder(Database<O> database,
                    DistanceFunction<O,D> distanceFunction)
Provides the cluster order of the OPTICS algorithm.

Parameters:
database - the database containing the objects
distanceFunction - the distance function of the OPTICS algorithm
Method Detail

add

public void add(Integer objectID,
                Integer predecessorID,
                D reachability)
Adds an object with the given predecessor and the given reachability to this cluster order.

Parameters:
objectID - the id of the object to be added
predecessorID - the id of the object's predecessor
reachability - the reachability of the object

size

public final int size()
Returns the size of this cluster order.

Returns:
the size of this cluster order

output

public void output(File out,
                   Normalization<O> normalization,
                   List<AttributeSettings> settings)
            throws UnableToComplyException
Description copied from interface: Result
Writes the clustering result to the given file. Clustering result implementations, which are likely to provide several clusters are supposed to use the filename as prefix for every file to create and to append a proper suffix. In case of occuring IOExceptions the output is expected to be given at the standard-out. Therefore this behaviour should be also achievable by giving a null-Object as parameter.

Specified by:
output in interface Result<O extends DatabaseObject>
Overrides:
output in class AbstractResult<O extends DatabaseObject>
Parameters:
out - file, which designates the location to write the results, or which's name designates the prefix of any locations to write the results, or which could remain null to designate the standard-out as location for output.
normalization - Normalization to restore original values according to, if this action is supported - may remain null.
settings - the settings to be written into the header, if this parameter is null, no header will be written
Throws:
UnableToComplyException - if any feature vector is not compatible with values initialized during normalization
See Also:
Result.output(File,Normalization,List)

output

public void output(PrintStream outStream,
                   Normalization<O> normalization,
                   List<AttributeSettings> settings)
            throws UnableToComplyException
Description copied from interface: Result
Writes the clustering result to the given stream.

Parameters:
outStream - the stream to write to
normalization - Normalization to restore original values according to, if this action is supported - may remain null.
settings - the settings to be written into the header, if this parameter is null, no header will be written
Throws:
UnableToComplyException - if any feature vector is not compatible with values initialized during normalization
See Also:
Result.output(java.io.PrintStream, de.lmu.ifi.dbs.elki.normalization.Normalization, java.util.List)

toString

public final String toString()
Returns a string representation of this cluster order.

Overrides:
toString in class Object
Returns:
a string representation of this cluster order

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object has the same attribute values as the o argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Returns:
a hash code value for the object

getMaxReachability

public D getMaxReachability()
Returns the maximum reachability in this cluster order.

Returns:
the maximum reachability in this cluster order

iterator

public Iterator<ClusterOrderEntry<D>> iterator()
Returns an iterator over the elements in this cluster order in proper sequence.

Returns:
an iterator over the elements in this cluster order in proper sequence.

Release 0.1 (2008-07-10_1838)