mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-27 08:51:41 +08:00
Fixed cpplint errors
This commit is contained in:
@@ -4,20 +4,20 @@
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
class graph {
|
class graph {
|
||||||
private:
|
private:
|
||||||
vector<vector<int>> adj;
|
vector<vector<int>> adj;
|
||||||
int connected_components;
|
int connected_components;
|
||||||
void depth_first_search();
|
void depth_first_search();
|
||||||
void explore(int, vector<bool>&);
|
void explore(int, vector<bool>&);
|
||||||
public:
|
public:
|
||||||
explicit graph(int n): adj(n, vector<int>()) {
|
explicit graph(int n): adj(n, vector<int>()) {
|
||||||
connected_components = 0;
|
connected_components = 0;
|
||||||
}
|
}
|
||||||
void addEdge(int, int);
|
void addEdge(int, int);
|
||||||
int getConnectedComponents() {
|
int getConnectedComponents() {
|
||||||
depth_first_search();
|
depth_first_search();
|
||||||
return connected_components;
|
return connected_components;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void graph::addEdge(int u, int v) {
|
void graph::addEdge(int u, int v) {
|
||||||
|
|||||||
Reference in New Issue
Block a user