diff --git a/graph/connected_components.cpp b/graph/connected_components.cpp index 18c99cf45..ec7ef19e6 100644 --- a/graph/connected_components.cpp +++ b/graph/connected_components.cpp @@ -2,7 +2,8 @@ * * \file * \brief [Connected Components - * (Connected Components)](https://en.wikipedia.org/wiki/Component_(graph_theory)) + * (Connected + * Components)](https://en.wikipedia.org/wiki/Component_(graph_theory)) * * \author [Ayaan Khan](http://github.com/ayaankhan98) * @@ -35,7 +36,7 @@ using std::vector; */ class graph { private: - /** \brief adj stores adjacency list representation of graph */ + /** \brief adj stores adjacency list representation of graph */ vector> adj; /** \brief keep track of connected components */ @@ -48,16 +49,16 @@ class graph { void explore(int, vector &); public: - /** + /** * \brief Constructor that intiliazes the graph on creation and set * the connected components to 0 */ explicit graph(int n) : adj(n, vector()) { connected_components = 0; } - + /** \brief Function to add a edge between two nodes or vertices of graph */ void addEdge(int, int); - /** + /** * \brief Function the calculates the connected compoents in the graph * by performing the depth first search on graph * @@ -112,14 +113,14 @@ void graph::explore(int u, vector &visited) { /** Main function */ int main() { - /// creating a graph with 4 vertex + /// creating a graph with 4 vertex graph g(4); - /// Adding edges between vertices + /// Adding edges between vertices g.addEdge(1, 2); g.addEdge(3, 2); - /// printing the connected components + /// printing the connected components std::cout << g.getConnectedComponents(); return 0; }