Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: dbscan algorithm

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Thanked 1 Time in 1 Post

    Post dbscan algorithm

    please help me..i cnt run this dbscan algorithm. i have project tommrow ..it is giving 59 errors..please send me dbscan working algo without errors.
    package algorithms;

    import input.Dataset;
    import input.Element;

    import java.util.Collection;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.SortedMap;

    * @author Markus
    public class DBSCAN implements ClusteringAlgorithm {

    float epsilon;
    int minPoints;

    public float getEpsilon() {
    return epsilon;
    public void setEpsilon(float epsilon) {
    this.epsilon = epsilon;
    public int getMinPoints() {
    return minPoints;
    public void setMinPoints(int minPoints) {
    this.minPoints = minPoints;
    /* (non-Javadoc)
    * @see algorithms.ClusteringAlgorithm#doClustering(input. Dataset)
    public void doClustering(Dataset dataset) {
    int currentClusterId = 0;
    for (int i = 0; i < dataset.size(); i++) {
    Element featureVector = dataset.get(i);
    if(featureVector.getCalculatedClusternumber() == Element.UNCLASSIFIED){
    if(this.expandCluster(i,currentClusterId, this.epsilon, this.minPoints, dataset ));
    currentClusterId ++;


    * @param featureVector
    * @param currentClusterId
    * @param gamma2
    * @param minPoints2
    private boolean expandCluster(int pointnumber, int currentClusterId, float gamma2, int minPoints2, Dataset dataset) {
    LinkedList<Integer> seeds = (LinkedList<Integer>) this.getNeighbours(dataset, pointnumber);
    if (seeds.size() < this.minPoints){ //no core point
    dataset.get(pointnumber).setCalculatedClusternumbe r(Element.NOISE);
    return false;
    for (Integer i : seeds) {
    dataset.get(i).setCalculatedClusternumber(currentC lusterId);
    while (!seeds.isEmpty()){
    int currentPoint = seeds.getFirst();
    Collection<Integer> result = this.getNeighbours(dataset, currentPoint);

    if (result.size() >= this.minPoints){
    for (Integer resultPId : result) {
    Element resultP = dataset.get(resultPId);
    if (resultP.getCalculatedClusternumber() == Element.UNCLASSIFIED){
    resultP.setCalculatedClusternumber(currentClusterI d);
    if (resultP.getCalculatedClusternumber() == Element.NOISE){
    resultP.setCalculatedClusternumber(currentClusterI d);
    return true;

    * This method queries the dataset for the neighbours of the passed element (id) that
    * satisfie [dist (id, x) <= epsilon for x element of dataset] .
    * The method returns the ids of the points that fullfill the condition
    * @param dataset
    * @param featureVector
    * @param id
    * @return list of ids that are in the epsilon neighborhood
    private Collection<Integer> getNeighbours(Dataset dataset, int id) {
    SortedMap<Float, List<Integer>> neigbourList = dataset.getNeighbourMatrix()[id];
    List<Integer> result = new LinkedList<Integer>();
    //because the api returns strictly smaller we add a small value.
    Collection <List<Integer>>closepoints = neigbourList.headMap(this.epsilon +0.0000000000000001f).values();
    for (List<Integer> list : closepoints) {
    return result;


    public String toString(){
    return "DBSCAN";


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 827 Times in 770 Posts
    Blog Entries

    Default Re: dbscan algorithm

    it is giving 59 errors..please send me dbscan working algo without errors.
    And...what are the errors? We are neither a code service or a fixit service, so providing all information helps someone else come along and provide guidance.

Similar Threads

  1. Creating an algorithm to do this
    By colerelm in forum Java Theory & Questions
    Replies: 4
    Last Post: October 16th, 2012, 02:54 PM
  2. CRC algorithm
    By aldykid in forum Algorithms & Recursion
    Replies: 1
    Last Post: August 7th, 2011, 10:50 AM
  3. all i need is algorithm
    By coder.freak in forum Paid Java Projects
    Replies: 3
    Last Post: April 6th, 2011, 11:11 AM
  4. [SOLVED] Algorithm Help
    By aussiemcgr in forum Java Theory & Questions
    Replies: 2
    Last Post: September 10th, 2010, 04:12 PM
  5. algorithm
    By AmmrO in forum Algorithms & Recursion
    Replies: 13
    Last Post: September 24th, 2009, 09:18 PM

Tags for this Thread