From a26101f37fc5a7751b65580f66ce1fa912af8e56 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Fri, 18 Sep 2020 17:37:07 +0000 Subject: [PATCH] Documentation for d4b54b8294722607f8ed1e29f2b3ff500ba787e7 --- d8/d95/vector__ops_8hpp_source.html | 10 +- df/d82/breadth__first__search_8cpp.html | 178 ++++--- df/d82/breadth__first__search_8cpp.js | 9 +- ...3bb8ccf42aaf7375a83e91490eda1e_cgraph.map} | 6 +- ...83bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 | 1 + ...3bb8ccf42aaf7375a83e91490eda1e_cgraph.svg} | 6 +- ...8ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 | 1 - ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 8 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 8 +- df/dce/namespacegraph.html | 131 +++-- ...0d3bf6c8a63f8071395c53a3cd148d_cgraph.map} | 0 ...0d3bf6c8a63f8071395c53a3cd148d_cgraph.md5} | 0 ...0d3bf6c8a63f8071395c53a3cd148d_cgraph.svg} | 0 ...9b4441a0e447469e9a4f61c87f33102_cgraph.md5 | 1 - ...7d0cbc90b3b921d02da35d58b63153_cgraph.map} | 2 +- ...c7d0cbc90b3b921d02da35d58b63153_cgraph.md5 | 1 + ...7d0cbc90b3b921d02da35d58b63153_cgraph.svg} | 2 +- globals_func_i.html | 6 +- globals_func_t.html | 2 +- globals_i.html | 6 +- globals_t.html | 2 +- menudata.js | 3 +- namespacemembers.html | 9 +- namespacemembers_func.html | 6 +- namespacemembers_type.html | 107 ++++ navtreedata.js | 5 +- navtreeindex1.js | 2 +- navtreeindex5.js | 20 +- navtreeindex6.js | 2 + search/all_1.js | 149 +++--- search/all_10.js | 212 ++++---- search/all_11.js | 42 +- search/all_12.js | 208 ++++---- search/all_13.js | 480 +++++++++--------- search/all_14.js | 216 ++++---- search/all_15.js | 128 ++--- search/all_16.js | 92 ++-- search/all_17.js | 158 +++--- search/all_18.js | 12 +- search/all_19.js | 8 +- search/all_1a.js | 6 +- search/all_1b.js | 186 +++---- search/all_2.js | 168 +++--- search/all_3.js | 208 ++++---- search/all_4.js | 224 ++++---- search/all_5.js | 136 ++--- search/all_6.js | 246 ++++----- search/all_7.js | 148 +++--- search/all_8.js | 82 +-- search/all_9.js | 374 +++++++------- search/all_a.js | 14 +- search/all_b.js | 30 +- search/all_c.js | 158 +++--- search/all_d.js | 230 ++++----- search/all_e.js | 140 ++--- search/all_f.js | 136 ++--- search/classes_0.js | 36 +- search/classes_1.js | 78 +-- search/classes_10.js | 6 +- search/classes_11.js | 80 +-- search/classes_12.js | 96 ++-- search/classes_13.js | 46 +- search/classes_14.js | 64 +-- search/classes_15.js | 38 +- search/classes_16.js | 62 +-- search/classes_17.js | 4 +- search/classes_18.js | 2 +- search/classes_2.js | 70 +-- search/classes_3.js | 32 +- search/classes_4.js | 34 +- search/classes_5.js | 34 +- search/classes_6.js | 12 +- search/classes_7.js | 16 +- search/classes_8.js | 196 +++---- search/classes_9.js | 2 +- search/classes_a.js | 4 +- search/classes_b.js | 36 +- search/classes_c.js | 74 +-- search/classes_d.js | 36 +- search/classes_e.js | 24 +- search/classes_f.js | 34 +- search/defines_0.js | 4 +- search/defines_1.js | 4 +- search/defines_2.js | 4 +- search/defines_3.js | 2 +- search/defines_4.js | 4 +- search/defines_5.js | 4 +- search/defines_6.js | 4 +- search/files_0.js | 8 +- search/files_1.js | 26 +- search/files_10.js | 14 +- search/files_11.js | 4 +- search/files_12.js | 30 +- search/files_13.js | 10 +- search/files_14.js | 6 +- search/files_15.js | 2 +- search/files_2.js | 14 +- search/files_3.js | 18 +- search/files_4.js | 6 +- search/files_5.js | 18 +- search/files_6.js | 14 +- search/files_7.js | 14 +- search/files_8.js | 8 +- search/files_9.js | 4 +- search/files_a.js | 8 +- search/files_b.js | 24 +- search/files_c.js | 14 +- search/files_d.js | 12 +- search/files_e.js | 8 +- search/files_f.js | 20 +- search/functions_0.js | 6 +- search/functions_1.js | 166 +++--- search/functions_10.js | 158 +++--- search/functions_11.js | 18 +- search/functions_12.js | 154 +++--- search/functions_13.js | 374 +++++++------- search/functions_14.js | 160 +++--- search/functions_15.js | 84 +-- search/functions_16.js | 46 +- search/functions_17.js | 146 +++--- search/functions_18.js | 6 +- search/functions_19.js | 2 +- search/functions_1a.js | 4 +- search/functions_1b.js | 186 +++---- search/functions_2.js | 116 ++--- search/functions_3.js | 152 +++--- search/functions_4.js | 184 +++---- search/functions_5.js | 112 ++-- search/functions_6.js | 208 ++++---- search/functions_7.js | 126 ++--- search/functions_8.js | 40 +- search/functions_9.js | 186 +++---- search/functions_a.js | 6 +- search/functions_b.js | 18 +- search/functions_c.js | 100 ++-- search/functions_d.js | 164 +++--- search/functions_e.js | 102 ++-- search/functions_f.js | 116 ++--- search/groups_0.js | 2 +- search/groups_1.js | 4 +- search/groups_2.js | 2 +- search/namespaces_0.js | 2 +- search/namespaces_1.js | 2 +- search/namespaces_10.js | 2 +- search/namespaces_2.js | 4 +- search/namespaces_3.js | 6 +- search/namespaces_4.js | 4 +- search/namespaces_5.js | 4 +- search/namespaces_6.js | 2 +- search/namespaces_7.js | 2 +- search/namespaces_8.js | 6 +- search/namespaces_9.js | 6 +- search/namespaces_a.js | 6 +- search/namespaces_b.js | 4 +- search/namespaces_c.js | 2 +- search/namespaces_d.js | 26 +- search/namespaces_e.js | 2 +- search/namespaces_f.js | 2 +- search/pages_0.js | 2 +- search/pages_1.js | 2 +- search/pages_2.js | 2 +- search/pages_3.js | 4 +- search/related_0.js | 10 +- search/searchdata.js | 2 +- search/typedefs_0.js | 2 +- search/typedefs_1.js | 2 +- search/typedefs_2.js | 2 +- search/typedefs_3.html | 36 ++ search/typedefs_3.js | 4 + search/variables_0.js | 4 +- search/variables_1.js | 8 +- search/variables_10.js | 20 +- search/variables_11.js | 2 +- search/variables_12.js | 4 +- search/variables_13.js | 2 +- search/variables_14.js | 2 +- search/variables_15.js | 2 +- search/variables_2.js | 2 +- search/variables_3.js | 2 +- search/variables_4.js | 4 +- search/variables_5.js | 8 +- search/variables_6.js | 16 +- search/variables_7.js | 4 +- search/variables_8.js | 2 +- search/variables_9.js | 6 +- search/variables_a.js | 10 +- search/variables_b.js | 8 +- search/variables_c.js | 12 +- search/variables_d.js | 4 +- search/variables_e.js | 2 +- search/variables_f.js | 18 +- 192 files changed, 4894 insertions(+), 4697 deletions(-) rename df/d82/{breadth__first__search_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map => breadth__first__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map} (91%) create mode 100644 df/d82/breadth__first__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 rename df/d82/{breadth__first__search_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg => breadth__first__search_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg} (98%) delete mode 100644 df/d82/breadth__first__search_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 rename df/dce/{namespacegraph_a618dce14b4883c20aace1d743d3a3f60_cgraph.map => namespacegraph_a0e0d3bf6c8a63f8071395c53a3cd148d_cgraph.map} (100%) rename df/dce/{namespacegraph_a618dce14b4883c20aace1d743d3a3f60_cgraph.md5 => namespacegraph_a0e0d3bf6c8a63f8071395c53a3cd148d_cgraph.md5} (100%) rename df/dce/{namespacegraph_a618dce14b4883c20aace1d743d3a3f60_cgraph.svg => namespacegraph_a0e0d3bf6c8a63f8071395c53a3cd148d_cgraph.svg} (100%) delete mode 100644 df/dce/namespacegraph_a59b4441a0e447469e9a4f61c87f33102_cgraph.md5 rename df/dce/{namespacegraph_a59b4441a0e447469e9a4f61c87f33102_cgraph.map => namespacegraph_a8c7d0cbc90b3b921d02da35d58b63153_cgraph.map} (85%) create mode 100644 df/dce/namespacegraph_a8c7d0cbc90b3b921d02da35d58b63153_cgraph.md5 rename df/dce/{namespacegraph_a59b4441a0e447469e9a4f61c87f33102_cgraph.svg => namespacegraph_a8c7d0cbc90b3b921d02da35d58b63153_cgraph.svg} (96%) create mode 100644 namespacemembers_type.html create mode 100644 search/typedefs_3.html create mode 100644 search/typedefs_3.js diff --git a/d8/d95/vector__ops_8hpp_source.html b/d8/d95/vector__ops_8hpp_source.html index c2ddf2ea3..77618c4da 100644 --- a/d8/d95/vector__ops_8hpp_source.html +++ b/d8/d95/vector__ops_8hpp_source.html @@ -621,7 +621,6 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
std::max_element
T max_element(T... args)
machine_learning::uniform_random_initialization
void uniform_random_initialization(std::vector< std::valarray< T >> &A, const std::pair< size_t, size_t > &shape, const T &low, const T &high)
Definition: vector_ops.hpp:166
std::setprecision
T setprecision(T... args)
-
graph::breadth_first_search
std::vector< bool > breadth_first_search(const std::vector< std::vector< int >> &graph, int start)
Function performs the breadth first search algorithm over the graph.
Definition: breadth_first_search.cpp:96
std::vector::resize
T resize(T... args)
std::bitset< MAXN >
linear_probing::Entry::key
int key
key value
Definition: linear_probing_hash_table.cpp:37
@@ -715,7 +714,6 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
hash_chain
Chain class with a given modulus.
Definition: chaining.cpp:16
get_clock_diff
double get_clock_diff(clock_t start_t, clock_t end_t)
Definition: kohonen_som_trace.cpp:452
test2
void test2(const std::string &text)
Self test 2 - using 8x8 randomly generated key.
Definition: hill_cipher.cpp:505
-
graph::add_directed_edge
void add_directed_edge(std::vector< std::vector< int >> *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:66
std::setfill
T setfill(T... args)
std::reverse
T reverse(T... args)
Graph::Graph
Graph(unsigned int vertices, std::vector< Edge > const &edges)
Definition: cycle_check_directed_graph.cpp:88
@@ -750,8 +748,9 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
machine_learning::adaline::check_size_match
bool check_size_match(const std::vector< double > &x)
Definition: adaline_learning.cpp:196
std::sqrt
T sqrt(T... args)
stack_idx
int stack_idx
pointer to track stack index
Definition: paranthesis_matching.cpp:23
+
tests
static void tests()
Definition: breadth_first_search.cpp:134
machine_learning::neural_network::NeuralNetwork::evaluate_from_csv
void evaluate_from_csv(const std::string &file_name, const bool &last_label, const bool &normalize, const int &slip_lines=1)
Definition: neural_network.cpp:638
-
main
int main()
Definition: breadth_first_search.cpp:162
+
main
int main()
Definition: breadth_first_search.cpp:174
test1
void test1()
Definition: kohonen_som_trace.cpp:233
std::vector::clear
T clear(T... args)
hash_chain::add
void add(int x, int h)
create and add a new node with a give value and at a given height
Definition: chaining.cpp:45
@@ -783,6 +782,7 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
graph::RootedTree::parent
std::vector< int > parent
Stores parent of every vertex and for root its own index. The root is technically not its own parent,...
Definition: lowest_common_ancestor.cpp:104
graph::dijkstra
int dijkstra(std::vector< std::vector< std::pair< int, int >>> *adj, int s, int t)
Function runs the dijkstra algorithm for some source vertex and target vertex in the graph and return...
Definition: dijkstra.cpp:66
CycleCheck::isCyclicDFSHelper
static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)
Definition: cycle_check_directed_graph.cpp:170
+
graph::add_undirected_edge
void add_undirected_edge(adjacency_list *graph, int u, int v)
Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacen...
Definition: breadth_first_search.cpp:92
machine_learning::neural_network::layers::DenseLayer::DenseLayer
DenseLayer(const int &neurons, const std::string &activation, const std::vector< std::valarray< double >> &kernal)
Definition: neural_network.cpp:183
graph::RootedTree::RootedTree
RootedTree(const std::vector< std::pair< int, int > > &undirected_edges, int root_)
Constructs the tree by calculating parent for every vertex. Assumes a valid description of a tree is ...
Definition: lowest_common_ancestor.cpp:93
MinHeapNode
Definition: huffman.cpp:7
@@ -837,6 +837,7 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
test_3d_classes1
void test_3d_classes1(std::vector< std::valarray< double >> *data)
Definition: kohonen_som_topology.cpp:411
fib
uint64_t fib(uint64_t n)
Definition: fibonacci_fast.cpp:30
quadratic_probing::rehash
void rehash()
Definition: quadratic_probing_hash_table.cpp:160
+
graph::breadth_first_search
std::vector< bool > breadth_first_search(const adjacency_list &graph, int start)
Function performs the breadth first search algorithm over the graph.
Definition: breadth_first_search.cpp:107
data_structures
Data Structures algorithms.
test2
void test2()
Definition: kohonen_som_topology.cpp:451
SegmentIntersection::on_segment
bool on_segment(Point first_point, Point second_point, Point third_point)
Definition: line_segment_intersection.cpp:75
@@ -850,7 +851,6 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
quadratic_probing::addInfo
void addInfo(int key)
Definition: quadratic_probing_hash_table.cpp:207
double_hashing::display
void display()
Definition: double_hash_hash_table.cpp:143
double_hashing::remove
void remove(int key)
Definition: double_hash_hash_table.cpp:199
-
graph::add_undirected_edge
void add_undirected_edge(std::vector< std::vector< int >> *graph, int u, int v)
Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacen...
Definition: breadth_first_search.cpp:81
data_structures::trie::NUM_CHARS
static constexpr uint8_t NUM_CHARS
Number of alphabets.
Definition: trie_tree.cpp:27
graph::is_graph_bipartite::Graph::adj
std::vector< std::vector< int > > adj
adj stores the graph as an adjacency list
Definition: is_graph_bipartite.cpp:56
main
int main()
Definition: jarvis_algorithm.cpp:176
@@ -879,7 +879,6 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
quadratic_probing::Entry::Entry
Entry(int key=notPresent)
constructor
Definition: quadratic_probing_hash_table.cpp:38
stack::top
Type top()
Definition: stack.h:93
geometry::jarvis::Convexhull
Definition: jarvis_algorithm.cpp:55
-
tests
void tests()
Definition: breadth_first_search.cpp:122
hamilton_cycle
bool hamilton_cycle(const std::vector< std::vector< bool >> &routes)
Definition: hamiltons_cycle.cpp:30
data_structures::trie::deleteString
bool deleteString(const std::string &str, int index)
Definition: trie_tree.cpp:134
tests
void tests()
Definition: connected_components.cpp:93
@@ -1003,6 +1002,7 @@ $(document).ready(function(){initNavTree('d8/d95/vector__ops_8hpp_source.html','
test3
static void test3()
Definition: hamiltons_cycle.cpp:122
std::vector::data
T data(T... args)
machine_learning::zeroes_initialization
void zeroes_initialization(std::vector< std::valarray< T >> &A, const std::pair< size_t, size_t > &shape)
Definition: vector_ops.hpp:213
+
graph::add_directed_edge
void add_directed_edge(adjacency_list *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:77
std::ofstream::is_open
T is_open(T... args)
std::set
STL class.
operator/
std::vector< float > operator/(std::vector< T > const &A, float const scalar)
Definition: ordinary_least_squares_regressor.cpp:174
diff --git a/df/d82/breadth__first__search_8cpp.html b/df/d82/breadth__first__search_8cpp.html index de5198479..ae00e1756 100644 --- a/df/d82/breadth__first__search_8cpp.html +++ b/df/d82/breadth__first__search_8cpp.html @@ -92,6 +92,7 @@ $(document).ready(function(){initNavTree('df/d82/breadth__first__search_8cpp.htm
Namespaces | +Typedefs | Functions
breadth_first_search.cpp File Reference
@@ -118,19 +119,25 @@ Namespaces  Graph algorithms.
  + + + + +

+Typedefs

using graph::adjacency_list = std::vector< std::vector< int > >
 Representation of the graph as an adjacency list. More...
 
- - - - - - - - - - - + + + + + + + + + + +

Functions

void graph::add_directed_edge (std::vector< std::vector< int >> *graph, int u, int v)
 Adds a directed edge from vertex u to vertex v. More...
 
void graph::add_undirected_edge (std::vector< std::vector< int >> *graph, int u, int v)
 Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacency list reprsentation of the graph. More...
 
std::vector< bool > graph::breadth_first_search (const std::vector< std::vector< int >> &graph, int start)
 Function performs the breadth first search algorithm over the graph. More...
 
void tests ()
 
void graph::add_directed_edge (adjacency_list *graph, int u, int v)
 Adds a directed edge from vertex u to vertex v. More...
 
void graph::add_undirected_edge (adjacency_list *graph, int u, int v)
 Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacency list reprsentation of the graph. More...
 
std::vector< bool > graph::breadth_first_search (const adjacency_list &graph, int start)
 Function performs the breadth first search algorithm over the graph. More...
 
static void tests ()
 
int main ()
 
@@ -174,30 +181,30 @@ Functions

Main function

-
162  {
-
163  tests();
-
164 
-
165  size_t vertices = 0, edges = 0;
-
166  std::cout << "Enter the number of vertices: ";
-
167  std::cin >> vertices;
-
168  std::cout << "Enter the number of edges: ";
-
169  std::cin >> edges;
-
170 
- -
172 
-
173  std::cout << "Enter space-separated pairs of vertices that form edges: "
-
174  << std::endl;
-
175  while (edges--) {
-
176  int u = 0, v = 0;
-
177  std::cin >> u >> v;
-
178  // Decrement the vertex index so that we can read more convenint
-
179  // 1-based indexing from the user input.
-
180  graph::add_directed_edge(&graph, u - 1, v - 1);
-
181  }
+
174  {
+
175  tests();
+
176 
+
177  size_t vertices = 0, edges = 0;
+
178  std::cout << "Enter the number of vertices: ";
+
179  std::cin >> vertices;
+
180  std::cout << "Enter the number of edges: ";
+
181  std::cin >> edges;
182 
- -
184  return 0;
-
185 }
+
183  graph::adjacency_list graph(vertices);
+
184 
+
185  std::cout << "Enter space-separated pairs of vertices that form edges: "
+
186  << std::endl;
+
187  while (edges--) {
+
188  int u = 0, v = 0;
+
189  std::cin >> u >> v;
+
190  // Decrement the vertex index so that we can read more convenint
+
191  // 1-based indexing from the user input.
+
192  graph::add_directed_edge(&graph, u - 1, v - 1);
+
193  }
+
194 
+ +
196  return 0;
+
197 }
Here is the call graph for this function:
@@ -207,65 +214,74 @@ Here is the call graph for this function:
- -

◆ tests()

+ +

◆ tests()

+ + + + + +
- +
void tests static void tests ( )
+
+static
+

Test function

Test 1 Begin

Test 2 Begin

Test 3 Begins

-
122  {
-
123  /// Test 1 Begin
- - - - -
128 
- -
130  std::vector<bool> correct_result = {true, true, true, true};
-
131 
-
132  assert(std::equal(correct_result.begin(), correct_result.end(),
-
133  returned_result.begin()));
-
134  std::cout << "Test 1 Passed..." << std::endl;
-
135 
-
136  /// Test 2 Begin
-
137  returned_result = graph::breadth_first_search(graph, 0);
-
138 
-
139  assert(std::equal(correct_result.begin(), correct_result.end(),
-
140  returned_result.begin()));
-
141  std::cout << "Test 2 Passed..." << std::endl;
-
142 
-
143  /// Test 3 Begins
-
144  graph.clear();
-
145  graph.resize(6);
- - - - - - -
152 
-
153  returned_result = graph::breadth_first_search(graph, 2);
-
154  correct_result = {false, false, true, true, false, true};
-
155 
-
156  assert(std::equal(correct_result.begin(), correct_result.end(),
-
157  returned_result.begin()));
-
158  std::cout << "Test 3 Passed..." << std::endl;
-
159 }
+
134  {
+
135  /// Test 1 Begin
+ + + + +
140 
+ +
142  std::vector<bool> correct_result = {true, true, true, true};
+
143 
+
144  assert(std::equal(correct_result.begin(), correct_result.end(),
+
145  returned_result.begin()));
+
146  std::cout << "Test 1 Passed..." << std::endl;
+
147 
+
148  /// Test 2 Begin
+
149  returned_result = graph::breadth_first_search(graph, 0);
+
150 
+
151  assert(std::equal(correct_result.begin(), correct_result.end(),
+
152  returned_result.begin()));
+
153  std::cout << "Test 2 Passed..." << std::endl;
+
154 
+
155  /// Test 3 Begins
+
156  graph.clear();
+
157  graph.resize(6);
+ + + + + + +
164 
+
165  returned_result = graph::breadth_first_search(graph, 2);
+
166  correct_result = {false, false, true, true, false, true};
+
167 
+
168  assert(std::equal(correct_result.begin(), correct_result.end(),
+
169  returned_result.begin()));
+
170  std::cout << "Test 3 Passed..." << std::endl;
+
171 }
Here is the call graph for this function:
-
+
@@ -273,18 +289,18 @@ Here is the call graph for this function:
-
graph::breadth_first_search
std::vector< bool > breadth_first_search(const std::vector< std::vector< int >> &graph, int start)
Function performs the breadth first search algorithm over the graph.
Definition: breadth_first_search.cpp:96
std::equal
T equal(T... args)
-
std::vector
STL class.
-
graph::add_directed_edge
void add_directed_edge(std::vector< std::vector< int >> *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:66
+
std::vector< std::vector< int > >
+
tests
static void tests()
Definition: breadth_first_search.cpp:134
+
graph::add_undirected_edge
void add_undirected_edge(adjacency_list *graph, int u, int v)
Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacen...
Definition: breadth_first_search.cpp:92
std::cout
-
graph::add_undirected_edge
void add_undirected_edge(std::vector< std::vector< int >> *graph, int u, int v)
Adds an undirected edge from vertex u to vertex v. Essentially adds too directed edges to the adjacen...
Definition: breadth_first_search.cpp:81
-
tests
void tests()
Definition: breadth_first_search.cpp:122
+
graph::breadth_first_search
std::vector< bool > breadth_first_search(const adjacency_list &graph, int start)
Function performs the breadth first search algorithm over the graph.
Definition: breadth_first_search.cpp:107
std::endl
T endl(T... args)
std::vector::begin
T begin(T... args)
graph
Graph algorithms.
std::vector::end
T end(T... args)
std::cin
+
graph::add_directed_edge
void add_directed_edge(adjacency_list *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:77
+

Function Documentation

+ +

◆ add_directed_edge()

@@ -159,7 +184,7 @@ Functions void graph::add_directed_edge ( - std::vector< std::vector< int >> *  + adjacency_listgraph, @@ -191,14 +216,14 @@ Functions -
66  {
-
67  (*graph)[u].push_back(v);
-
68 }
+
77  {
+
78  (*graph)[u].push_back(v);
+
79 }
- -

◆ add_undirected_edge()

+ +

◆ add_undirected_edge()

@@ -206,7 +231,7 @@ Functions void graph::add_undirected_edge ( - std::vector< std::vector< int >> *  + adjacency_listgraph, @@ -238,14 +263,14 @@ Functions -
81  {
-
82  add_directed_edge(graph, u, v);
-
83  add_directed_edge(graph, v, u);
-
84 }
+
92  {
+
93  add_directed_edge(graph, u, v);
+
94  add_directed_edge(graph, v, u);
+
95 }
Here is the call graph for this function:
-
+
@@ -413,8 +438,8 @@ Here is the call graph for this function:
- -

◆ breadth_first_search()

+ +

◆ breadth_first_search()

@@ -422,7 +447,7 @@ Here is the call graph for this function:
std::vector<bool> graph::breadth_first_search ( - const std::vector< std::vector< int >> &  + const adjacency_listgraph, @@ -449,36 +474,36 @@ Here is the call graph for this function:
Returns
a binary vector indicating which vertices were visited during the search.

vector to keep track of visited vertices

-

a queue that stores vertices that need to be further explored

+

queue that stores vertices that need to be further explored

mark the starting vertex as visited

if the vertex is not visited then mark it as visited and push it to the queue

-
97  {
-
98  /// vector to keep track of visited vertices
-
99  std::vector<bool> visited(graph.size(), false);
-
100  /// a queue that stores vertices that need to be further explored
-
101  std::queue<int> tracker;
-
102 
-
103  /// mark the starting vertex as visited
-
104  visited[start] = true;
-
105  tracker.push(start);
-
106  while (!tracker.empty()) {
-
107  size_t vertex = tracker.front();
-
108  tracker.pop();
-
109  for (auto x : graph[vertex]) {
-
110  /// if the vertex is not visited then mark it as visited
-
111  /// and push it to the queue
-
112  if (!visited[x]) {
-
113  visited[x] = true;
-
114  tracker.push(x);
-
115  }
-
116  }
-
117  }
-
118  return visited;
-
119 }
+
107  {
+
108  /// vector to keep track of visited vertices
+
109  std::vector<bool> visited(graph.size(), false);
+
110  /// queue that stores vertices that need to be further explored
+
111  std::queue<int> tracker;
+
112 
+
113  /// mark the starting vertex as visited
+
114  visited[start] = true;
+
115  tracker.push(start);
+
116  while (!tracker.empty()) {
+
117  size_t vertex = tracker.front();
+
118  tracker.pop();
+
119  for (auto x : graph[vertex]) {
+
120  /// if the vertex is not visited then mark it as visited
+
121  /// and push it to the queue
+
122  if (!visited[x]) {
+
123  visited[x] = true;
+
124  tracker.push(x);
+
125  }
+
126  }
+
127  }
+
128  return visited;
+
129 }
Here is the call graph for this function:
-
+
@@ -799,7 +824,6 @@ Here is the call graph for this function:
T size(T... args)
-
void add_directed_edge(std::vector< std::vector< int >> *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:66
STL class.
T front(T... args)
@@ -813,6 +837,7 @@ Here is the call graph for this function:
T empty(T... args)
T push(T... args)
T make_pair(T... args)
+
void add_directed_edge(adjacency_list *graph, int u, int v)
Adds a directed edge from vertex u to vertex v.
Definition: breadth_first_search.cpp:77