-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDBSCAN.h
44 lines (34 loc) · 913 Bytes
/
DBSCAN.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#ifndef DBSCAN_H
#define DBSCAN_H
#include <vector>
#include <list>
#include <algorithm>
enum DBSCANState{
UNVISITED,
VISITED,
NOISE
};
struct DBSCANData{
int id;
float val;
DBSCANState state;
bool clustered;
DBSCANData(float v);
};
class DBSCAN{
public:
DBSCAN(const std::vector<float>& data, float eps, int minPts);
~DBSCAN();
void clustering(std::vector<float>& output);
void expandCluster(DBSCANData* P, std::list<DBSCANData*>& NeighborPts, std::list<DBSCANData*>& C);
void regionQuery(DBSCANData* P, std::list<DBSCANData*>& output);
void floatVec2DBVec(const std::vector<float>& input, std::list<DBSCANData*>& output);
void DBVec2FloatVec(std::list<DBSCANData*>& input, std::vector<float>& output);
static int s_id;
private:
std::list<DBSCANData*> m_data;
float m_eps;
int m_minPts;
};
#endif