mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-24 18:43:17 +08:00
somemore cpplint fixing
This commit is contained in:
@@ -5,13 +5,13 @@ 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:
|
||||||
graph(int n): adj(n, vector<int>()) {
|
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() {
|
||||||
@@ -48,8 +48,8 @@ void graph::explore(int u, vector<bool> &visited) {
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
graph g(4);
|
graph g(4);
|
||||||
g.addEdge(1,2);
|
g.addEdge(1, 2);
|
||||||
g.addEdge(3,2);
|
g.addEdge(3, 2);
|
||||||
std::cout << g.getConnectedComponents();
|
std::cout << g.getConnectedComponents();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user