diff --git a/annotated.html b/annotated.html index 569a2ac81..991e7992f 100644 --- a/annotated.html +++ b/annotated.html @@ -157,10 +157,12 @@ $(function(){initNavTree('annotated.html',''); initResizable(true); });  NgraphGraph Algorithms  Nis_graph_bipartite  CGraphClass for representing graph as an adjacency list - CGraph - CHKGraphRepresents Bipartite graph for Hopcroft Karp implementation - CLowestCommonAncestor - CRootedTree + Ntopological_sort + CGraphClass that represents a directed graph and provides methods for manipulating the graph + CGraph + CHKGraphRepresents Bipartite graph for Hopcroft Karp implementation + CLowestCommonAncestor + CRootedTree  Ngreedy_algorithmsFor string class  NdijkstraFunctions for the Dijkstra algorithm implementation  CGraphWrapper class for storing a graph diff --git a/annotated_dup.js b/annotated_dup.js index 234646a62..db81bb2fa 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -66,6 +66,9 @@ var annotated_dup = [ "is_graph_bipartite", null, [ [ "Graph", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph" ] ] ], + [ "topological_sort", null, [ + [ "Graph", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html", "d5/dec/classgraph_1_1topological__sort_1_1_graph" ] + ] ], [ "Graph", "dc/d61/classgraph_1_1_graph.html", "dc/d61/classgraph_1_1_graph" ], [ "HKGraph", "d8/d69/classgraph_1_1_h_k_graph.html", "d8/d69/classgraph_1_1_h_k_graph" ], [ "LowestCommonAncestor", "d9/d23/classgraph_1_1_lowest_common_ancestor.html", "d9/d23/classgraph_1_1_lowest_common_ancestor" ], diff --git a/classes.html b/classes.html index a535e475e..963a5231d 100644 --- a/classes.html +++ b/classes.html @@ -129,7 +129,7 @@ $(function(){initNavTree('classes.html',''); initResizable(true); });
FCFS
fenwick_tree (range_queries)
G
-
generate_parentheses (backtracking)
geometric_distribution (probability::geometric_dist)
Graph
Graph (graph)
Graph (graph::is_graph_bipartite)
Graph (greedy_algorithms::dijkstra)
+
generate_parentheses (backtracking)
geometric_distribution (probability::geometric_dist)
Graph
Graph (graph)
Graph (graph::is_graph_bipartite)
Graph (graph::topological_sort)
Graph (greedy_algorithms::dijkstra)
H
Hash (hashing::sha256)
hash_chain
HillCipher (ciphers)
HKGraph (graph)
HLD (range_queries::heavy_light_decomposition)
diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph.html b/d5/dec/classgraph_1_1topological__sort_1_1_graph.html new file mode 100644 index 000000000..95f0c57c2 --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph.html @@ -0,0 +1,303 @@ + + + + + + + +Algorithms_in_C++: graph::topological_sort::Graph Class Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
graph::topological_sort::Graph Class Reference
+
+
+ +

Class that represents a directed graph and provides methods for manipulating the graph. + More...

+
+Collaboration diagram for graph::topological_sort::Graph:
+
+
+
[legend]
+ + + + + + + + + + + + + + +

+Public Member Functions

 Graph (int nodes)
 Constructor for the Graph class.
 
void addEdge (int u, int v)
 Function that adds an edge between two nodes or vertices of graph.
 
const std::vector< std::vector< int > > & getAdjacencyList () const
 Get the adjacency list of the graph.
 
int getNumNodes () const
 Get the number of nodes in the graph.
 
+ + + + + +

+Private Attributes

+int n
 
+std::vector< std::vector< int > > adj
 
+

Detailed Description

+

Class that represents a directed graph and provides methods for manipulating the graph.

+

Constructor & Destructor Documentation

+ +

◆ Graph()

+ +
+
+ + + + + +
+ + + + + + + +
graph::topological_sort::Graph::Graph (int nodes)
+
+inline
+
+ +

Constructor for the Graph class.

+
Parameters
+ + +
nodesNumber of nodes in the graph
+
+
+
48: n(nodes), adj(nodes) {}
+
+
+
+

Member Function Documentation

+ +

◆ addEdge()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
void graph::topological_sort::Graph::addEdge (int u,
int v )
+
+inline
+
+ +

Function that adds an edge between two nodes or vertices of graph.

+
Parameters
+ + + +
uStart node of the edge
vEnd node of the edge
+
+
+
55{ adj[u].push_back(v); }
+
T push_back(T... args)
+
+Here is the call graph for this function:
+
+
+
+ +
+
+ +

◆ getAdjacencyList()

+ +
+
+ + + + + +
+ + + + + + + +
const std::vector< std::vector< int > > & graph::topological_sort::Graph::getAdjacencyList () const
+
+inline
+
+ +

Get the adjacency list of the graph.

+
Returns
A reference to the adjacency list
+
61 {
+
62 return adj;
+
63 }
+
+
+
+ +

◆ getNumNodes()

+ +
+
+ + + + + +
+ + + + + + + +
int graph::topological_sort::Graph::getNumNodes () const
+
+inline
+
+ +

Get the number of nodes in the graph.

+
Returns
The number of nodes
+
69{ return n; }
+
+
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph.js b/d5/dec/classgraph_1_1topological__sort_1_1_graph.js new file mode 100644 index 000000000..1cd99dd4c --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph.js @@ -0,0 +1,7 @@ +var classgraph_1_1topological__sort_1_1_graph = +[ + [ "Graph", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html#a75a849f80a66304e7da39b3ccd6129d6", null ], + [ "addEdge", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html#a57036210706a45b9363563252393a345", null ], + [ "getAdjacencyList", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html#a5e84b175ef768ff58eaeededd43e8368", null ], + [ "getNumNodes", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html#ad22018e4f4f80aecb0538044bb83d096", null ] +]; \ No newline at end of file diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.map b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.map new file mode 100644 index 000000000..95ad6e2b1 --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.md5 b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.md5 new file mode 100644 index 000000000..24e04d4e0 --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.md5 @@ -0,0 +1 @@ +1b7f4d729ecbe66b97fdd869ae62df4d \ No newline at end of file diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.svg b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.svg new file mode 100644 index 000000000..7b98bf8e0 --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + +graph::topological_sort::Graph::addEdge + + +Node1 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node2 + + +std::vector::push_back + + + + + +Node1->Node2 + + + + + + + + + + + + + diff --git a/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph_org.svg b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph_org.svg new file mode 100644 index 000000000..6f9b78ead --- /dev/null +++ b/d5/dec/classgraph_1_1topological__sort_1_1_graph_a57036210706a45b9363563252393a345_cgraph_org.svg @@ -0,0 +1,40 @@ + + + + + + +graph::topological_sort::Graph::addEdge + + +Node1 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node2 + + +std::vector::push_back + + + + + +Node1->Node2 + + + + + + + + diff --git a/d6/dce/classgraph_1_1topological__sort_1_1_graph-members.html b/d6/dce/classgraph_1_1topological__sort_1_1_graph-members.html new file mode 100644 index 000000000..7168f7f78 --- /dev/null +++ b/d6/dce/classgraph_1_1topological__sort_1_1_graph-members.html @@ -0,0 +1,128 @@ + + + + + + + +Algorithms_in_C++: Member List + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
graph::topological_sort::Graph Member List
+
+
+ +

This is the complete list of members for graph::topological_sort::Graph, including all inherited members.

+ + + + + + + +
addEdge(int u, int v)graph::topological_sort::Graphinline
adj (defined in graph::topological_sort::Graph)graph::topological_sort::Graphprivate
getAdjacencyList() constgraph::topological_sort::Graphinline
getNumNodes() constgraph::topological_sort::Graphinline
Graph(int nodes)graph::topological_sort::Graphinline
n (defined in graph::topological_sort::Graph)graph::topological_sort::Graphprivate
+
+ + + + diff --git a/d8/d76/namespacetopological__sort.html b/d8/d76/namespacetopological__sort.html new file mode 100644 index 000000000..c6889875a --- /dev/null +++ b/d8/d76/namespacetopological__sort.html @@ -0,0 +1,125 @@ + + + + + + + +Algorithms_in_C++: topological_sort Namespace Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
topological_sort Namespace Reference
+
+
+ +

Topological Sort Algorithm. +More...

+

Detailed Description

+

Topological Sort Algorithm.

+
+
+ + + + diff --git a/d8/db9/topological__sort_8cpp.html b/d8/db9/topological__sort_8cpp.html new file mode 100644 index 000000000..6e55d31b2 --- /dev/null +++ b/d8/db9/topological__sort_8cpp.html @@ -0,0 +1,418 @@ + + + + + + + +Algorithms_in_C++: graph/topological_sort.cpp File Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
topological_sort.cpp File Reference
+
+
+ +

Topological Sort Algorithm +More...

+
#include <algorithm>
+#include <cassert>
+#include <iostream>
+#include <stack>
+#include <stdexcept>
+#include <vector>
+
+Include dependency graph for topological_sort.cpp:
+
+
+
+
+ + + + +

+Classes

class  graph::topological_sort::Graph
 Class that represents a directed graph and provides methods for manipulating the graph. More...
 
+ + + + + + + +

+Namespaces

namespace  graph
 Graph Algorithms.
 
namespace  topological_sort
 Topological Sort Algorithm.
 
+ + + + + + + + + + + + + +

+Functions

void graph::topological_sort::dfs (int v, std::vector< int > &visited, const std::vector< std::vector< int > > &graph, std::stack< int > &s)
 Function to perform Depth First Search on the graph.
 
std::vector< int > graph::topological_sort::topologicalSort (const Graph &g)
 Function to get the topological sort of the graph.
 
static void test ()
 Self-test implementation.
 
int main ()
 Main function.
 
+

Detailed Description

+

Topological Sort Algorithm

+

Topological sorting of a directed graph is a linear ordering or its vertices such that for every directed edge (u,v) from vertex u to vertex v, u comes before v in the oredering.

+

A topological sort is possible only in a directed acyclic graph (DAG). This file contains code of finding topological sort using Kahn's Algorithm which involves using Depth First Search technique

+

Function Documentation

+ +

◆ dfs()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
void graph::topological_sort::dfs (int v,
std::vector< int > & visited,
const std::vector< std::vector< int > > & graph,
std::stack< int > & s )
+
+ +

Function to perform Depth First Search on the graph.

+
Parameters
+ + + + + +
vStarting vertex for depth-first search
visitedArray representing whether each node has been visited
graphAdjacency list of the graph
sStack containing the vertices for topological sorting
+
+
+
80 {
+
81 visited[v] = 1;
+
82 for (int neighbour : graph[v]) {
+
83 if (!visited[neighbour]) {
+
84 dfs(neighbour, visited, graph, s);
+
85 }
+
86 }
+
87 s.push(v);
+
88}
+
std::vector< size_t > dfs(const std::vector< std::vector< size_t > > &graph, size_t start)
Explores the given vertex, exploring a vertex means traversing over all the vertices which are connec...
Definition depth_first_search_with_stack.cpp:87
+
Graph Algorithms.
+
T push(T... args)
+
+Here is the call graph for this function:
+
+
+
+ +
+
+ +

◆ main()

+ +
+
+ + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+
186 {
+
187 test(); // run self test implementations
+
188 return 0;
+
189}
+
static void test()
Self-test implementation.
Definition topological_sort.cpp:126
+
+Here is the call graph for this function:
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + +
static void test ()
+
+static
+
+ +

Self-test implementation.

+
Returns
void
+
126 {
+
127 // Test 1
+
128 std::cout << "Testing for graph 1\n";
+
129 int n_1 = 6;
+ +
131 graph1.addEdge(4, 0);
+
132 graph1.addEdge(5, 0);
+
133 graph1.addEdge(5, 2);
+
134 graph1.addEdge(2, 3);
+
135 graph1.addEdge(3, 1);
+
136 graph1.addEdge(4, 1);
+ +
138 std::vector<int> expected_1 = {5, 4, 2, 3, 1, 0};
+
139 std::cout << "Topological Sorting Order: ";
+
140 for (int i : ans_1) {
+
141 std::cout << i << " ";
+
142 }
+
143 std::cout << '\n';
+
144 assert(ans_1 == expected_1);
+
145 std::cout << "Test Passed\n\n";
+
146
+
147 // Test 2
+
148 std::cout << "Testing for graph 2\n";
+
149 int n_2 = 5;
+ +
151 graph2.addEdge(0, 1);
+
152 graph2.addEdge(0, 2);
+
153 graph2.addEdge(1, 2);
+
154 graph2.addEdge(2, 3);
+
155 graph2.addEdge(1, 3);
+
156 graph2.addEdge(2, 4);
+ +
158 std::vector<int> expected_2 = {0, 1, 2, 4, 3};
+
159 std::cout << "Topological Sorting Order: ";
+
160 for (int i : ans_2) {
+
161 std::cout << i << " ";
+
162 }
+
163 std::cout << '\n';
+
164 assert(ans_2 == expected_2);
+
165 std::cout << "Test Passed\n\n";
+
166
+
167 // Test 3 - Graph with cycle
+
168 std::cout << "Testing for graph 3\n";
+
169 int n_3 = 3;
+ +
171 graph3.addEdge(0, 1);
+
172 graph3.addEdge(1, 2);
+
173 graph3.addEdge(2, 0);
+
174 try {
+ +
176 } catch (std::invalid_argument& err) {
+
177 assert(std::string(err.what()) == "cycle detected in graph");
+
178 }
+
179 std::cout << "Test Passed\n";
+
180}
+ + +
Class that represents a directed graph and provides methods for manipulating the graph.
Definition topological_sort.cpp:38
+ +
std::vector< int > topologicalSort(const Graph &g)
Function to get the topological sort of the graph.
Definition topological_sort.cpp:95
+ + +
+Here is the call graph for this function:
+
+
+
+ +
+
+ +

◆ topologicalSort()

+ +
+
+ + + + + + + +
std::vector< int > graph::topological_sort::topologicalSort (const Graph & g)
+
+ +

Function to get the topological sort of the graph.

+
Parameters
+ + +
gGraph object
+
+
+
Returns
A vector containing the topological order of nodes
+
95 {
+
96 int n = g.getNumNodes();
+
97 const auto& adj = g.getAdjacencyList();
+
98 std::vector<int> visited(n, 0);
+ +
100
+
101 for (int i = 0; i < n; i++) {
+
102 if (!visited[i]) {
+
103 dfs(i, visited, adj, s);
+
104 }
+
105 }
+
106
+ +
108 while (!s.empty()) {
+
109 int elem = s.top();
+
110 s.pop();
+
111 ans.push_back(elem);
+
112 }
+
113
+
114 if (ans.size() < n) { // Cycle detected
+
115 throw std::invalid_argument("cycle detected in graph");
+
116 }
+
117 return ans;
+
118}
+
double g(double x)
Another test function.
Definition composite_simpson_rule.cpp:115
+
T empty(T... args)
+
T pop(T... args)
+ +
T top(T... args)
+
+Here is the call graph for this function:
+
+
+
+ +
+
+
+
+ + + + diff --git a/d8/db9/topological__sort_8cpp.js b/d8/db9/topological__sort_8cpp.js new file mode 100644 index 000000000..b91d0054a --- /dev/null +++ b/d8/db9/topological__sort_8cpp.js @@ -0,0 +1,8 @@ +var topological__sort_8cpp = +[ + [ "graph::topological_sort::Graph", "d5/dec/classgraph_1_1topological__sort_1_1_graph.html", "d5/dec/classgraph_1_1topological__sort_1_1_graph" ], + [ "dfs", "d8/db9/topological__sort_8cpp.html#abcbcaa2bb70af0a11d0c090ea1796aea", null ], + [ "main", "d8/db9/topological__sort_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "test", "d8/db9/topological__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ], + [ "topologicalSort", "d8/db9/topological__sort_8cpp.html#a54dc5d7914958dbd24dda2fd862dc41b", null ] +]; \ No newline at end of file diff --git a/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.map b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.map new file mode 100644 index 000000000..43d3289f1 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.md5 b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.md5 new file mode 100644 index 000000000..fd0fa3fc5 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.md5 @@ -0,0 +1 @@ +24301cf49b8e2366b08e2093da497fa4 \ No newline at end of file diff --git a/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.svg b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.svg new file mode 100644 index 000000000..d063d3deb --- /dev/null +++ b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + +graph::topological_sort::topologicalSort + + +Node1 + + +graph::topological +_sort::topologicalSort + + + + + +Node1->Node1 + + + + + + + + +Node2 + + +std::stack::empty + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +std::stack::pop + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +std::stack::top + + + + + +Node1->Node4 + + + + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph_org.svg b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph_org.svg new file mode 100644 index 000000000..1c2c2259f --- /dev/null +++ b/d8/db9/topological__sort_8cpp_a54dc5d7914958dbd24dda2fd862dc41b_cgraph_org.svg @@ -0,0 +1,85 @@ + + + + + + +graph::topological_sort::topologicalSort + + +Node1 + + +graph::topological +_sort::topologicalSort + + + + + +Node1->Node1 + + + + + + + + +Node2 + + +std::stack::empty + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +std::stack::pop + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +std::stack::top + + + + + +Node1->Node4 + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map new file mode 100644 index 000000000..f69c51e7a --- /dev/null +++ b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 new file mode 100644 index 000000000..e5b1fffdc --- /dev/null +++ b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -0,0 +1 @@ +f140bb29072388bd284df714025255c3 \ No newline at end of file diff --git a/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg new file mode 100644 index 000000000..942a8af00 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + +test + + +Node1 + + +test + + + + + +Node2 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node1->Node2 + + + + + + + + +Node4 + + +std::invalid_argument +::what + + + + + +Node1->Node4 + + + + + + + + +Node3 + + +std::vector::push_back + + + + + +Node2->Node3 + + + + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg new file mode 100644 index 000000000..a7299442c --- /dev/null +++ b/d8/db9/topological__sort_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg @@ -0,0 +1,77 @@ + + + + + + +test + + +Node1 + + +test + + + + + +Node2 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node1->Node2 + + + + + + + + +Node4 + + +std::invalid_argument +::what + + + + + +Node1->Node4 + + + + + + + + +Node3 + + +std::vector::push_back + + + + + +Node2->Node3 + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.map b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.map new file mode 100644 index 000000000..d24be3787 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.md5 b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.md5 new file mode 100644 index 000000000..dd33f8f26 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.md5 @@ -0,0 +1 @@ +cc93c261f53b1ac9b0c3d837e99862f0 \ No newline at end of file diff --git a/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.svg b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.svg new file mode 100644 index 000000000..e97284538 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + +graph::topological_sort::dfs + + +Node1 + + +graph::topological +_sort::dfs + + + + + +Node2 + + +std::stack::push + + + + + +Node1->Node2 + + + + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph_org.svg b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph_org.svg new file mode 100644 index 000000000..61b366fbe --- /dev/null +++ b/d8/db9/topological__sort_8cpp_abcbcaa2bb70af0a11d0c090ea1796aea_cgraph_org.svg @@ -0,0 +1,40 @@ + + + + + + +graph::topological_sort::dfs + + +Node1 + + +graph::topological +_sort::dfs + + + + + +Node2 + + +std::stack::push + + + + + +Node1->Node2 + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..4b81e0a30 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..eb28a2150 --- /dev/null +++ b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +8460728898871e1e4e3eda289d593379 \ No newline at end of file diff --git a/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..428de6d5b --- /dev/null +++ b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node2->Node3 + + + + + + + + +Node5 + + +std::invalid_argument +::what + + + + + +Node2->Node5 + + + + + + + + +Node4 + + +std::vector::push_back + + + + + +Node3->Node4 + + + + + + + + + + + + + diff --git a/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg new file mode 100644 index 000000000..ce07057cf --- /dev/null +++ b/d8/db9/topological__sort_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -0,0 +1,95 @@ + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +graph::topological +_sort::Graph::addEdge + + + + + +Node2->Node3 + + + + + + + + +Node5 + + +std::invalid_argument +::what + + + + + +Node2->Node5 + + + + + + + + +Node4 + + +std::vector::push_back + + + + + +Node3->Node4 + + + + + + + + diff --git a/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.map b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.map new file mode 100644 index 000000000..fb8468ced --- /dev/null +++ b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.md5 b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.md5 new file mode 100644 index 000000000..f75483b46 --- /dev/null +++ b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.md5 @@ -0,0 +1 @@ +3b2e9757bc23370a01bb8ca8c6dedc02 \ No newline at end of file diff --git a/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.svg b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.svg new file mode 100644 index 000000000..21658eeeb --- /dev/null +++ b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + +graph::topological_sort::Graph + + +Node1 + + +graph::topological +_sort::Graph + + + + + +Node2 + + +std::vector< std::vector +< int > > + + + + + +Node2->Node1 + + + + + + adj + + + + + + + + diff --git a/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph_org.svg b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph_org.svg new file mode 100644 index 000000000..37678e7c7 --- /dev/null +++ b/da/d15/classgraph_1_1topological__sort_1_1_graph__coll__graph_org.svg @@ -0,0 +1,42 @@ + + + + + + +graph::topological_sort::Graph + + +Node1 + + +graph::topological +_sort::Graph + + + + + +Node2 + + +std::vector< std::vector +< int > > + + + + + +Node2->Node1 + + + + + + adj + + + diff --git a/de/da9/topological__sort_8cpp__incl.map b/de/da9/topological__sort_8cpp__incl.map new file mode 100644 index 000000000..cdc509ffd --- /dev/null +++ b/de/da9/topological__sort_8cpp__incl.map @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/de/da9/topological__sort_8cpp__incl.md5 b/de/da9/topological__sort_8cpp__incl.md5 new file mode 100644 index 000000000..c8a83424d --- /dev/null +++ b/de/da9/topological__sort_8cpp__incl.md5 @@ -0,0 +1 @@ +a25af2b101c17f865848cac260c71b95 \ No newline at end of file diff --git a/de/da9/topological__sort_8cpp__incl.svg b/de/da9/topological__sort_8cpp__incl.svg new file mode 100644 index 000000000..3903aa328 --- /dev/null +++ b/de/da9/topological__sort_8cpp__incl.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + +graph/topological_sort.cpp + + +Node1 + + +graph/topological_sort.cpp + + + + + +Node2 + + +algorithm + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cassert + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +stack + + + + + +Node1->Node5 + + + + + + + + +Node6 + + +stdexcept + + + + + +Node1->Node6 + + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + + + + + + + + + + + diff --git a/de/da9/topological__sort_8cpp__incl_org.svg b/de/da9/topological__sort_8cpp__incl_org.svg new file mode 100644 index 000000000..cbcfef29a --- /dev/null +++ b/de/da9/topological__sort_8cpp__incl_org.svg @@ -0,0 +1,129 @@ + + + + + + +graph/topological_sort.cpp + + +Node1 + + +graph/topological_sort.cpp + + + + + +Node2 + + +algorithm + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cassert + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +iostream + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +stack + + + + + +Node1->Node5 + + + + + + + + +Node6 + + +stdexcept + + + + + +Node1->Node6 + + + + + + + + +Node7 + + +vector + + + + + +Node1->Node7 + + + + + + + + diff --git a/dir_12552d7fa429bf94a2e32e5cf39f7e69.html b/dir_12552d7fa429bf94a2e32e5cf39f7e69.html index cbc862aa1..6ddac6c2f 100644 --- a/dir_12552d7fa429bf94a2e32e5cf39f7e69.html +++ b/dir_12552d7fa429bf94a2e32e5cf39f7e69.html @@ -143,6 +143,9 @@ Files  lowest_common_ancestor.cpp  Data structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting.
  + topological_sort.cppTopological Sort Algorithm
 travelling_salesman_problem.cpp  [Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementation
  diff --git a/dir_12552d7fa429bf94a2e32e5cf39f7e69.js b/dir_12552d7fa429bf94a2e32e5cf39f7e69.js index 9d8cba6fc..aee90d224 100644 --- a/dir_12552d7fa429bf94a2e32e5cf39f7e69.js +++ b/dir_12552d7fa429bf94a2e32e5cf39f7e69.js @@ -11,5 +11,6 @@ var dir_12552d7fa429bf94a2e32e5cf39f7e69 = [ "hopcroft_karp.cpp", "d1/d9a/hopcroft__karp_8cpp.html", "d1/d9a/hopcroft__karp_8cpp" ], [ "is_graph_bipartite.cpp", "d6/dd8/is__graph__bipartite_8cpp.html", "d6/dd8/is__graph__bipartite_8cpp" ], [ "lowest_common_ancestor.cpp", "de/dde/lowest__common__ancestor_8cpp.html", "de/dde/lowest__common__ancestor_8cpp" ], + [ "topological_sort.cpp", "d8/db9/topological__sort_8cpp.html", "d8/db9/topological__sort_8cpp" ], [ "travelling_salesman_problem.cpp", "de/d88/travelling__salesman__problem_8cpp.html", "de/d88/travelling__salesman__problem_8cpp" ] ]; \ No newline at end of file diff --git a/doxygen_crawl.html b/doxygen_crawl.html index 51ea0c9bd..aceae8cec 100644 --- a/doxygen_crawl.html +++ b/doxygen_crawl.html @@ -114,6 +114,7 @@ + @@ -520,6 +521,8 @@ + + @@ -704,6 +707,7 @@ + @@ -2059,6 +2063,11 @@ + + + + + @@ -2513,6 +2522,7 @@ + @@ -2656,6 +2666,11 @@ + + + + + @@ -3177,6 +3192,8 @@ + + diff --git a/files.html b/files.html index 08908134b..9d663ce13 100644 --- a/files.html +++ b/files.html @@ -214,7 +214,8 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm  hopcroft_karp.cppImplementation of Hopcroft–Karp algorithm  is_graph_bipartite.cppAlgorithm to check whether a graph is bipartite  lowest_common_ancestor.cppData structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting - travelling_salesman_problem.cpp[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementation + topological_sort.cppTopological Sort Algorithm + travelling_salesman_problem.cpp[Travelling Salesman Problem] (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementation   graphics  spirograph.cppImplementation of Spirograph   greedy_algorithms diff --git a/functions_a.html b/functions_a.html index c2661940c..0e74489f3 100644 --- a/functions_a.html +++ b/functions_a.html @@ -117,7 +117,7 @@ $(function(){initNavTree('functions_a.html',''); initResizable(true); });
  • add_digit() : large_number
  • add_edge() : graph::Graph< T >, greedy_algorithms::dijkstra::Graph, range_queries::heavy_light_decomposition::Tree< X >
  • addBinary() : greedy_algorithms::BinaryAddition
  • -
  • addEdge() : Graph, graph::HKGraph, graph::is_graph_bipartite::Graph
  • +
  • addEdge() : Graph, graph::HKGraph, graph::is_graph_bipartite::Graph, graph::topological_sort::Graph
  • addProcess() : FCFS< S, T, E >
  • addVertices() : Graph
  • adj : graph::HKGraph, graph::is_graph_bipartite::Graph
  • diff --git a/functions_func_a.html b/functions_func_a.html index 7dee571ca..8669bb064 100644 --- a/functions_func_a.html +++ b/functions_func_a.html @@ -115,7 +115,7 @@ $(function(){initNavTree('functions_func_a.html',''); initResizable(true); });
  • add_digit() : large_number
  • add_edge() : graph::Graph< T >, greedy_algorithms::dijkstra::Graph, range_queries::heavy_light_decomposition::Tree< X >
  • addBinary() : greedy_algorithms::BinaryAddition
  • -
  • addEdge() : Graph, graph::HKGraph, graph::is_graph_bipartite::Graph
  • +
  • addEdge() : Graph, graph::HKGraph, graph::is_graph_bipartite::Graph, graph::topological_sort::Graph
  • addProcess() : FCFS< S, T, E >
  • addVertices() : Graph
  • arg() : Complex
  • diff --git a/functions_func_g.html b/functions_func_g.html index ee5ac4073..f6654f307 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -132,6 +132,7 @@ $(function(){initNavTree('functions_func_g.html',''); initResizable(true); });
  • get_size() : machine_learning::aystar_search::EightPuzzle< N >
  • get_state() : machine_learning::aystar_search::EightPuzzle< N >
  • get_XY_from_csv() : machine_learning::neural_network::NeuralNetwork
  • +
  • getAdjacencyList() : graph::topological_sort::Graph
  • getAdjList() : Graph
  • GetChild() : data_structures::tree_234::Node
  • GetChildIndex() : data_structures::tree_234::Node
  • @@ -149,13 +150,14 @@ $(function(){initNavTree('functions_func_g.html',''); initResizable(true); });
  • getMin() : MinHeap
  • GetMinItem() : data_structures::tree_234::Node
  • GetNextPossibleChild() : data_structures::tree_234::Node
  • +
  • getNumNodes() : graph::topological_sort::Graph
  • getPageFault() : others::lru_cache::LRUCache
  • getParents() : dsu
  • GetRightmostChild() : data_structures::tree_234::Node
  • GetTreeMaxItem() : data_structures::tree_234::Tree234
  • GetTreeMinItem() : data_structures::tree_234::Tree234
  • getVertices() : Graph
  • -
  • Graph() : Graph, graph::Graph< T >, graph::is_graph_bipartite::Graph, greedy_algorithms::dijkstra::Graph
  • +
  • Graph() : Graph, graph::Graph< T >, graph::is_graph_bipartite::Graph, graph::topological_sort::Graph, greedy_algorithms::dijkstra::Graph
  • diff --git a/functions_g.html b/functions_g.html index b81b1c510..cc3bbcc93 100644 --- a/functions_g.html +++ b/functions_g.html @@ -132,6 +132,7 @@ $(function(){initNavTree('functions_g.html',''); initResizable(true); });
  • get_size() : machine_learning::aystar_search::EightPuzzle< N >
  • get_state() : machine_learning::aystar_search::EightPuzzle< N >
  • get_XY_from_csv() : machine_learning::neural_network::NeuralNetwork
  • +
  • getAdjacencyList() : graph::topological_sort::Graph
  • getAdjList() : Graph
  • GetChild() : data_structures::tree_234::Node
  • GetChildIndex() : data_structures::tree_234::Node
  • @@ -149,6 +150,7 @@ $(function(){initNavTree('functions_g.html',''); initResizable(true); });
  • getMin() : MinHeap
  • GetMinItem() : data_structures::tree_234::Node
  • GetNextPossibleChild() : data_structures::tree_234::Node
  • +
  • getNumNodes() : graph::topological_sort::Graph
  • getPageFault() : others::lru_cache::LRUCache
  • getParents() : dsu
  • GetRightmostChild() : data_structures::tree_234::Node
  • @@ -156,7 +158,7 @@ $(function(){initNavTree('functions_g.html',''); initResizable(true); });
  • GetTreeMinItem() : data_structures::tree_234::Tree234
  • getVertices() : Graph
  • good_suffix : strings::boyer_moore::pattern
  • -
  • Graph() : Graph, graph::Graph< T >, graph::is_graph_bipartite::Graph, greedy_algorithms::dijkstra::Graph
  • +
  • Graph() : Graph, graph::Graph< T >, graph::is_graph_bipartite::Graph, graph::topological_sort::Graph, greedy_algorithms::dijkstra::Graph
  • diff --git a/globals_func_m.html b/globals_func_m.html index df0187134..5330928eb 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -107,7 +107,7 @@ $(function(){initNavTree('globals_func_m.html',''); initResizable(true); });
    Here is a list of all documented functions with links to the documentation:

    - m -