Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using 2D Coords #8

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
11ba7e6
🚧 Updating the code
amarrerod Apr 1, 2022
6ea7265
🔖 Initial version works
amarrerod Apr 1, 2022
4ce74a7
🐛 Includes working example
amarrerod Apr 1, 2022
5f18ad6
✨ Example completed
amarrerod Apr 1, 2022
c424e64
Create c-cpp.yml
amarrerod Apr 1, 2022
c94af7d
Merge branch 'master' of github.com:amarrerod/DBSCAN
amarrerod Apr 1, 2022
695d59d
✨ Reduces complexity with only 2dims
amarrerod Apr 1, 2022
d68f4fb
📝 Updates README
amarrerod Apr 1, 2022
4c16b98
👷 Working on deploy
amarrerod Apr 1, 2022
ddecebe
🚚 Moving stuff
amarrerod Apr 3, 2022
8017055
💚 Fixing Cmake installation
amarrerod Apr 4, 2022
ca690b5
🚧 Working on the lib
amarrerod Apr 4, 2022
76c74c2
🚧 Working on shared lib
amarrerod Apr 5, 2022
6f50381
Update dbscan.pc.in
amarrerod Apr 5, 2022
c38c27c
🐛 Fix an installation bug
amarrerod Apr 5, 2022
fe7d2e0
Merge branch 'master' of github.com:amarrerod/DBSCAN
amarrerod Apr 5, 2022
a29cfe6
💚 Working on build
amarrerod Apr 5, 2022
bf93bb0
✨ Introduces cluster counter
amarrerod Apr 6, 2022
59b93d0
🧐 Includes data samples
amarrerod Apr 6, 2022
ae288c8
♻️ Includes return in run method
amarrerod Apr 6, 2022
346a13d
✨ Introduces new constructor
amarrerod Apr 7, 2022
f4add23
✨ Includes the cluster class
amarrerod Apr 25, 2022
05c2d58
🐛 Fixes a bug in the DBSCAN code
amarrerod May 2, 2022
e5cecaf
🐛 Fixes the algorithm an cluster generation
amarrerod May 2, 2022
48c0bd8
👷 Updates installation configuration
amarrerod Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🐛 Fixes the algorithm an cluster generation
  • Loading branch information
amarrerod committed May 2, 2022
commit e5cecaf05c551e20e20d2084f5dd8ba2552136db
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"makefile_output_printer": "makefile",
"makefile_migration_topology": "makefile",
"*.tcc": "cpp",
"fstream": "cpp"
"fstream": "cpp",
"deque": "cpp",
"string": "cpp",
"vector": "cpp"
}
}
3 changes: 2 additions & 1 deletion example/simpleExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ int main(int argc, char **argv) {
// constructor
DBSCAN ds(MINIMUM_POINTS, EPSILON, points);
// main loop
ds.run();
auto nClusters = ds.run();
std::cout << "There are " << nClusters << " clusters " << std::endl;
for (auto p : ds.getPoints()) {
std::cout << p << std::endl;
}
Expand Down
24 changes: 22 additions & 2 deletions src/dbscan/dbscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "dbscan.h"

#include <map>

/**
* @brief Construct a new DBSCAN::DBSCAN object
*
Expand Down Expand Up @@ -43,7 +45,6 @@ DBSCAN::DBSCAN(const unsigned int& minPts, const float& eps,
p.y = y;
p.clusterID = UNCLASSIFIED;
m_points.push_back(p);
std::cout << p << std::endl;
}
}

Expand All @@ -62,7 +63,26 @@ int DBSCAN::run() {
}
}
}
return 0;
// Creating the clusters
std::map<int, vector<coords>> clusters;

for (unsigned int i = 1; i <= this->nClusters; i++) {
m_clusters.push_back(Cluster(i));
}
// Filling the cluster
for (const Point& p : m_points) {
if (p.clusterID != UNCLASSIFIED) {
if (clusters.find(p.clusterID) != clusters.end()) {
clusters.insert({p.clusterID, {}});
}
clusters[p.clusterID].push_back({p.x, p.y});
}
}
for (auto [id, points] : clusters) {
this->m_clusters.push_back(Cluster(id, points));
}
this->nClusters = clusters.size();
return nClusters;
}

/**
Expand Down