Beispiel #1
0
unsigned int DBSCAN::run(Clustering &c){
    unsigned int clusterID = 1;
    vector<unsigned int> neighbours;
    double cout_limit = 0.0;
    
    cout << "db node_count: " << node_count << endl;
    for(unsigned int nodeID = 0; nodeID < node_count; nodeID++){
        
        if (double(nodeID) / node_count >= cout_limit){
            cout << double(nodeID) / node_count * 100 << " %" << endl;
            cout_limit+=.05;
        }
        
        //cout << "h" << endl;
        if (!visited[nodeID]){
            visited[nodeID] = true;
            neighbours.clear();
            //cout << "i" << endl;
            if (met->getNeighbors(nodeID, neighbours)){
                //cout << "j" << endl;
                cluster[nodeID] = clusterID;
                //visited[nodeID] = true;
                expand(neighbours, clusterID);
                clusterID++;
            }
        }
    }
    
    c.resize(clusterID);
    
    met->expand(c, cluster);
    
    return clusterID;
};