de.uni_leipzig.bf.cluster
Class BorderFlow

java.lang.Object
  extended by de.uni_leipzig.bf.cluster.BorderFlow

public class BorderFlow
extends java.lang.Object

Author:
an
 

Field Summary
protected  ClusterCache cache
           
protected  java.sql.Connection con
           
protected  java.lang.String database
           
protected  ClusterGraph graph
           
protected  Harden harden
           
protected  java.lang.String ip
           
protected  java.lang.String password
           
protected  java.lang.String user
           
 
Constructor Summary
BorderFlow(java.lang.String file, Harden p_harden)
          Constructs new instance for tabulator separated files.
BorderFlow(java.lang.String file, java.lang.String separator, Harden p_harden)
          Constructs new instance.
 
Method Summary
 void closeConnection()
          Close connection to database.
 java.lang.String cluster(double connThreshold, boolean testOne, boolean heuristic, boolean caching)
          Starts Borderflow with the given configuration to write in String.
 java.lang.String cluster(java.lang.String[] p_seeds, boolean testOne, boolean heuristic, boolean caching)
          Starts Borderflow with the given configuration to write in String.
 void clusterToDatabase(double connThreshold)
          Clusters to the database found under connection
 void clusterToFile(java.lang.String outputFile, double connThreshold, boolean testOne, boolean heuristic, boolean caching)
          Starts Borderflow with the given configuration to write in file.
 double compareSet(java.util.Set<java.lang.Integer> set1, java.util.Set<java.lang.Integer> set2)
           
 double getAbsoluteFlow(Cluster c, java.lang.Integer node)
          Computes the inverse relative flow to make sure that no division by zero is carried out
 java.sql.Connection getConnection()
          Get connection to database
 double getFlowFromNodeToSet(java.util.TreeSet<java.lang.Integer> nodeSet, java.lang.Integer node)
          Compute flow from node to set of nodes
 double getInverseRelativeFlow(Cluster c, java.lang.Integer node)
          Computes the inverse relative flow to make sure that no division by zero is carried out
 double getRelativerFlow(java.util.TreeSet<java.lang.Integer> nodes)
           
 java.lang.String getSilhouetteAndRelativeFlow(java.util.TreeSet<java.lang.Integer> nodes)
          Computes the silhouette for a set of nodes
protected  java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> harden(java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> clusterSeedMap)
          Harden method used a Harden instance.
 java.util.TreeSet<java.lang.Integer> heuristicGetCluster(java.lang.Integer seed)
          Compute cluster for a given seed using heuristic version of BorderFlow.
 java.util.TreeSet<java.lang.Integer> heuristicGetClusterTestOne(java.lang.Integer seed)
          Compute cluster for a given seed using heuristic and test one version of BorderFlow.
 java.util.TreeSet<java.lang.Integer> knnCluster(java.lang.Integer seed, int k)
          Compute cluster for a given seed.
 void knnToFile(java.lang.String outputFile, double connThreshold, int k)
          Starts knn with the given configuration to write in file.
 java.lang.String knnToString(double connThreshold, int k)
          Starts knn with the given configuration to write in String.
 java.lang.String knnToString(java.lang.String[] p_seeds, int k)
          Starts knn with the given configuration to write in String.
 java.util.TreeSet<java.lang.Integer> optimalGetCluster(java.lang.Integer seed)
          Compute cluster for a given seed using optimal version of BorderFlow.
 java.util.TreeSet<java.lang.Integer> optimalGetClusterTestOne(java.lang.Integer seed)
          Compute cluster for a given seed using optimal and test one version of BorderFlow.
 void setDatabaseVariables(java.lang.String _ip, java.lang.String _database, java.lang.String _user, java.lang.String _password)
          Set database variables.
protected  java.lang.String writeToString(java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> clusterSeedMap)
          Writes clusterSeedMap to String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected ClusterCache cache

con

protected java.sql.Connection con

database

protected java.lang.String database

graph

protected ClusterGraph graph

harden

protected Harden harden

ip

protected java.lang.String ip

password

protected java.lang.String password

user

protected java.lang.String user
Constructor Detail

BorderFlow

public BorderFlow(java.lang.String file,
                  Harden p_harden)
Constructs new instance for tabulator separated files.

Parameters:
file - path to file
p_harden - a Harden instance.

BorderFlow

public BorderFlow(java.lang.String file,
                  java.lang.String separator,
                  Harden p_harden)
Constructs new instance.

Parameters:
file - path to file
separator - file separator
p_harden - a Harden instance.
Method Detail

closeConnection

public void closeConnection()
Close connection to database.


cluster

public java.lang.String cluster(double connThreshold,
                                boolean testOne,
                                boolean heuristic,
                                boolean caching)
Starts Borderflow with the given configuration to write in String.

Parameters:
connThreshold - gives the percentage of the maximal connectivity that a node can maximally have to be used as seed
testOne - sets the type of test to use
heuristic - heuristic or the optimal version of borderflow
caching - sets cache version or not
Returns:
clusters

cluster

public java.lang.String cluster(java.lang.String[] p_seeds,
                                boolean testOne,
                                boolean heuristic,
                                boolean caching)
Starts Borderflow with the given configuration to write in String.

Parameters:
p_seeds - Strings to be used as seed
testOne - sets the type of test to use
heuristic - heuristic or the optimal version of borderflow
caching - sets cache version or not
Returns:
clusters

clusterToDatabase

public void clusterToDatabase(double connThreshold)
Clusters to the database found under connection


clusterToFile

public void clusterToFile(java.lang.String outputFile,
                          double connThreshold,
                          boolean testOne,
                          boolean heuristic,
                          boolean caching)
Starts Borderflow with the given configuration to write in file.

Parameters:
outputFile - Output is written in outputFile
connThreshold - gives the percentage of the maximal connectivity that a node can maximally have to be used as seed
testOne - sets the type of test to use
heuristic - heuristic or the optimal version of borderflow
caching - sets cache version or not

compareSet

public double compareSet(java.util.Set<java.lang.Integer> set1,
                         java.util.Set<java.lang.Integer> set2)

getAbsoluteFlow

public double getAbsoluteFlow(Cluster c,
                              java.lang.Integer node)
Computes the inverse relative flow to make sure that no division by zero is carried out


getConnection

public java.sql.Connection getConnection()
Get connection to database


getFlowFromNodeToSet

public double getFlowFromNodeToSet(java.util.TreeSet<java.lang.Integer> nodeSet,
                                   java.lang.Integer node)
Compute flow from node to set of nodes


getInverseRelativeFlow

public double getInverseRelativeFlow(Cluster c,
                                     java.lang.Integer node)
Computes the inverse relative flow to make sure that no division by zero is carried out


getRelativerFlow

public double getRelativerFlow(java.util.TreeSet<java.lang.Integer> nodes)

getSilhouetteAndRelativeFlow

public java.lang.String getSilhouetteAndRelativeFlow(java.util.TreeSet<java.lang.Integer> nodes)
Computes the silhouette for a set of nodes


harden

protected java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> harden(java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> clusterSeedMap)
Harden method used a Harden instance.

Parameters:
clusterSeedMap - soft clusters
Returns:
clusterSeedMap hard clusters

heuristicGetCluster

public java.util.TreeSet<java.lang.Integer> heuristicGetCluster(java.lang.Integer seed)
Compute cluster for a given seed using heuristic version of BorderFlow.


heuristicGetClusterTestOne

public java.util.TreeSet<java.lang.Integer> heuristicGetClusterTestOne(java.lang.Integer seed)
Compute cluster for a given seed using heuristic and test one version of BorderFlow.


knnCluster

public java.util.TreeSet<java.lang.Integer> knnCluster(java.lang.Integer seed,
                                                       int k)
Compute cluster for a given seed.


knnToFile

public void knnToFile(java.lang.String outputFile,
                      double connThreshold,
                      int k)
Starts knn with the given configuration to write in file.


knnToString

public java.lang.String knnToString(double connThreshold,
                                    int k)
Starts knn with the given configuration to write in String.


knnToString

public java.lang.String knnToString(java.lang.String[] p_seeds,
                                    int k)
Starts knn with the given configuration to write in String.


optimalGetCluster

public java.util.TreeSet<java.lang.Integer> optimalGetCluster(java.lang.Integer seed)
Compute cluster for a given seed using optimal version of BorderFlow.


optimalGetClusterTestOne

public java.util.TreeSet<java.lang.Integer> optimalGetClusterTestOne(java.lang.Integer seed)
Compute cluster for a given seed using optimal and test one version of BorderFlow.


setDatabaseVariables

public void setDatabaseVariables(java.lang.String _ip,
                                 java.lang.String _database,
                                 java.lang.String _user,
                                 java.lang.String _password)
Set database variables.


writeToString

protected java.lang.String writeToString(java.util.HashMap<java.util.TreeSet<java.lang.Integer>,java.util.TreeSet<java.lang.Integer>> clusterSeedMap)
Writes clusterSeedMap to String.

Parameters:
clusterSeedMap - with clusters and seeds
Returns:
clusters