diff --git a/annotated.html b/annotated.html index 07c4e3fd0..5c54b8e5a 100644 --- a/annotated.html +++ b/annotated.html @@ -121,31 +121,33 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();  CEdge  CFenwickTree  CGraph - Cgraph - Chash_chainChain class with a given modulus - CItem - Clarge_number - Clca - Clinkedlist - Clist - CMinHeap - CMinHeapNode - Cmst - CNode - Cnode - CPoint - Cquery - CQueue - Cqueue - CQueue_Array - CSegmentIntersection - CSolution - Cstack - Cstack_linkedList - Ctower - Ctrie - CTrie - CTrieNode + Cgraph + CGraph + CLowestCommonAncestor + CRootedTree + Chash_chainChain class with a given modulus + CItem + Clarge_number + Clinkedlist + Clist + CMinHeap + CMinHeapNode + Cmst + Cnode + CNode + CPoint + Cquery + Cqueue + CQueue + CQueue_Array + CSegmentIntersection + CSolution + Cstack + Cstack_linkedList + Ctower + Ctrie + CTrie + CTrieNode diff --git a/annotated_dup.js b/annotated_dup.js index 3c9d7167e..2081c03f8 100644 --- a/annotated_dup.js +++ b/annotated_dup.js @@ -20,18 +20,17 @@ var annotated_dup = [ "hash_chain", "dd/d1c/classhash__chain.html", "dd/d1c/classhash__chain" ], [ "Item", "db/d66/struct_item.html", "db/d66/struct_item" ], [ "large_number", "db/d82/classlarge__number.html", "db/d82/classlarge__number" ], - [ "lca", "dd/df4/structlca.html", "dd/df4/structlca" ], [ "linkedlist", "d0/dff/structlinkedlist.html", "d0/dff/structlinkedlist" ], [ "list", "d8/d10/structlist.html", "d8/d10/structlist" ], [ "MinHeap", "d2/d05/class_min_heap.html", "d2/d05/class_min_heap" ], [ "MinHeapNode", "d5/d29/struct_min_heap_node.html", "d5/d29/struct_min_heap_node" ], [ "mst", "d1/d77/structmst.html", "d1/d77/structmst" ], - [ "Node", "db/d8b/struct_node.html", "db/d8b/struct_node" ], [ "node", "d5/da1/structnode.html", "d5/da1/structnode" ], + [ "Node", "db/d8b/struct_node.html", "db/d8b/struct_node" ], [ "Point", "d8/dc8/struct_point.html", "d8/dc8/struct_point" ], [ "query", "dd/d1b/structquery.html", "dd/d1b/structquery" ], - [ "Queue", "dc/db5/struct_queue.html", "dc/db5/struct_queue" ], [ "queue", "db/da9/classqueue.html", "db/da9/classqueue" ], + [ "Queue", "dc/db5/struct_queue.html", "dc/db5/struct_queue" ], [ "Queue_Array", "d0/dd2/class_queue___array.html", "d0/dd2/class_queue___array" ], [ "SegmentIntersection", "d4/db4/struct_segment_intersection.html", "d4/db4/struct_segment_intersection" ], [ "Solution", "dd/d4f/class_solution.html", "dd/d4f/class_solution" ], diff --git a/classes.html b/classes.html index fd5e25dca..9b7edf3b1 100644 --- a/classes.html +++ b/classes.html @@ -94,103 +94,108 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
Class Index
-
a | b | c | d | e | f | g | h | i | l | m | n | p | q | s | t
+
a | b | c | d | e | f | g | h | i | l | m | n | p | q | r | s | t
- + - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
  a  
  e  
+
Entry (linear_probing)   
  l  
HillCipher (ciphers)   
  n  
-
SkipList (data_structure)   
  i  
+
  p  
Solution   
adaline (machine_learning)   Edge   Node   
Entry (quadratic_probing)    stack   
adaline (machine_learning)   Entry (double_hashing)   large_number   Point   stack_linkedList   
  b  
Entry (double_hashing)   Item   Node (data_structure)   stack_linkedList   
Entry (linear_probing)   
  l  
-
node   stats_computer1 (statistics)   
Btree   Entry (quadratic_probing)   
  p  
-
stats_computer2 (statistics)   
  c  
-
  f  
large_number   
  t  
-
lca   Point   
cll   FenwickTree    linkedlist   
  q  
tower   stats_computer1 (statistics)   
compare   
list   stats_computer2 (statistics)   
Btree   FenwickTree   graph::LowestCommonAncestor   query   
  t  
+
  c  
+
  g  
list   trie   
Complex   
  m  
query   queue   
Queue   tower   
cll   Graph   MinHeap   Queue_Array   trie   
compare   graph   MinHeapNode   
  r  
+
Trie   
CycleCheck   Graph   Queue   
Complex   graph::Graph   mst    Trie::TrieNode   
CycleCheck   
  h  
+
  n  
+
graph::RootedTree   
  d  
graph   MinHeap   queue   
  h  
-
MinHeapNode   Queue_Array   
double_linked_list   mst   
  s  
hash_chain   
SegmentIntersection   
hash_chain   Node (data_structure)   
double_linked_list   HillCipher (ciphers)   node   SegmentIntersection   
  e  
+
  i  
+
Node   SkipList (data_structure)   
Edge   Item   
-
a | b | c | d | e | f | g | h | i | l | m | n | p | q | s | t
+
a | b | c | d | e | f | g | h | i | l | m | n | p | q | r | s | t
diff --git a/d0/d24/classgraph_1_1_rooted_tree__coll__graph.map b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.map new file mode 100644 index 000000000..f99dd2cd2 --- /dev/null +++ b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/d0/d24/classgraph_1_1_rooted_tree__coll__graph.md5 b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.md5 new file mode 100644 index 000000000..8ac5403eb --- /dev/null +++ b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.md5 @@ -0,0 +1 @@ +749777ad85452feddc9d7cd0fbff0c07 \ No newline at end of file diff --git a/d0/d24/classgraph_1_1_rooted_tree__coll__graph.svg b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.svg new file mode 100644 index 000000000..d2370c877 --- /dev/null +++ b/d0/d24/classgraph_1_1_rooted_tree__coll__graph.svg @@ -0,0 +1,71 @@ + + + + + + +graph::RootedTree + + + +Node1 + + +graph::RootedTree + + + + + +Node2 + + +graph::Graph + + + + + +Node2->Node1 + + + + + +Node3 + + +std::vector< std::vector +< int > > + + + + + +Node3->Node2 + + + neighbors + + + +Node4 + + +std::vector< int > + + + + + +Node4->Node1 + + + parent +level + + + diff --git a/d0/d58/classgraph_1_1_rooted_tree.html b/d0/d58/classgraph_1_1_rooted_tree.html new file mode 100644 index 000000000..38193d769 --- /dev/null +++ b/d0/d58/classgraph_1_1_rooted_tree.html @@ -0,0 +1,290 @@ + + + + + + + +Algorithms_in_C++: graph::RootedTree Class Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ +  1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
graph::RootedTree Class Reference
+
+
+
+Inheritance diagram for graph::RootedTree:
+
+
+
+
[legend]
+
+Collaboration diagram for graph::RootedTree:
+
+
+
+
[legend]
+ + + + + + + + + + + +

+Public Member Functions

 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 provided. More...
 
- Public Member Functions inherited from graph::Graph
 Graph (size_t N, const std::vector< std::pair< int, int > > &undirected_edges)
 Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid vertex indices. More...
 
int number_of_vertices () const
 
+ + + + + + + + + + + + + + +

+Public Attributes

+std::vector< int > parent
 Stores parent of every vertex and for root its own index. The root is technically not its own parent, but it's very practical for the lowest common ancestor algorithm.
 
+std::vector< int > level
 Stores the distance from the root.
 
+int root
 Index of the root vertex.
 
- Public Attributes inherited from graph::Graph
+std::vector< std::vector< int > > neighbors
 for each vertex it stores a list indicies of its neighbors
 
+ + + + +

+Protected Member Functions

void populate_parents ()
 Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm starting from the root vertex searching the entire tree and labeling parents for all vertices. More...
 
+

Detailed Description

+

Representation of a rooted tree. For every vertex its parent is precalculated.

+

Constructor & Destructor Documentation

+ +

◆ RootedTree()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
graph::RootedTree::RootedTree (const std::vector< std::pair< int, int > > & undirected_edges,
int root_ 
)
+
+inline
+
+ +

Constructs the tree by calculating parent for every vertex. Assumes a valid description of a tree is provided.

+
Parameters
+ + + +
undirected_edgeslist of graph's undirected edges
root_index of the root vertex
+
+
+
94  : Graph(undirected_edges.size() + 1, undirected_edges), root(root_) {
+ +
96  }
+
+
+
+

Member Function Documentation

+ +

◆ populate_parents()

+ +
+
+ + + + + +
+ + + + + + + +
void graph::RootedTree::populate_parents ()
+
+inlineprotected
+
+ +

Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm starting from the root vertex searching the entire tree and labeling parents for all vertices.

+
Returns
none
+
116  {
+
117  // Initialize the vector with -1 which indicates the vertex
+
118  // wasn't yet visited.
+ + +
121  parent[root] = root;
+
122  level[root] = 0;
+
123  std::queue<int> queue_of_vertices;
+
124  queue_of_vertices.push(root);
+
125  while (!queue_of_vertices.empty()) {
+
126  int vertex = queue_of_vertices.front();
+
127  queue_of_vertices.pop();
+
128  for (int neighbor : neighbors[vertex]) {
+
129  // As long as the vertex was not yet visited.
+
130  if (parent[neighbor] == -1) {
+
131  parent[neighbor] = vertex;
+
132  level[neighbor] = level[vertex] + 1;
+
133  queue_of_vertices.push(neighbor);
+
134  }
+
135  }
+
136  }
+
137  }
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+
+
graph::Graph::Graph
Graph(size_t N, const std::vector< std::pair< int, int > > &undirected_edges)
Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid v...
Definition: lowest_common_ancestor.cpp:61
+
graph::RootedTree::level
std::vector< int > level
Stores the distance from the root.
Definition: lowest_common_ancestor.cpp:105
+
std::vector< int >
+
std::vector::size
T size(T... args)
+
graph::RootedTree::populate_parents
void populate_parents()
Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm...
Definition: lowest_common_ancestor.cpp:116
+
std::queue
STL class.
+
std::queue::front
T front(T... args)
+
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:103
+
graph::Graph::neighbors
std::vector< std::vector< int > > neighbors
for each vertex it stores a list indicies of its neighbors
Definition: lowest_common_ancestor.cpp:78
+
std::queue::pop
T pop(T... args)
+
graph::Graph::number_of_vertices
int number_of_vertices() const
Definition: lowest_common_ancestor.cpp:73
+
std::queue::empty
T empty(T... args)
+
std::queue::push
T push(T... args)
+
graph::RootedTree::root
int root
Index of the root vertex.
Definition: lowest_common_ancestor.cpp:107
+ + + + diff --git a/d0/d58/classgraph_1_1_rooted_tree.js b/d0/d58/classgraph_1_1_rooted_tree.js new file mode 100644 index 000000000..8d9c50799 --- /dev/null +++ b/d0/d58/classgraph_1_1_rooted_tree.js @@ -0,0 +1,8 @@ +var classgraph_1_1_rooted_tree = +[ + [ "RootedTree", "d0/d58/classgraph_1_1_rooted_tree.html#aacdeecac857623e9fbfe92590f3c504d", null ], + [ "populate_parents", "d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e", null ], + [ "level", "d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3", null ], + [ "parent", "d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43", null ], + [ "root", "d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe", null ] +]; \ No newline at end of file diff --git a/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.map b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.map new file mode 100644 index 000000000..08071b807 --- /dev/null +++ b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.md5 b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.md5 new file mode 100644 index 000000000..2738235cf --- /dev/null +++ b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.md5 @@ -0,0 +1 @@ +30afca0f7f3d555dd0b3b04338cf4c7b \ No newline at end of file diff --git a/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.svg b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.svg new file mode 100644 index 000000000..888411701 --- /dev/null +++ b/d0/d58/classgraph_1_1_rooted_tree_ae6928f3ebd491541e9570e746b877c1e_cgraph.svg @@ -0,0 +1,114 @@ + + + + + + +graph::RootedTree::populate_parents + + + +Node1 + + +graph::RootedTree:: +populate_parents + + + + + +Node2 + + +std::queue::empty + + + + + +Node1->Node2 + + + + + +Node3 + + +std::queue::front + + + + + +Node1->Node3 + + + + + +Node4 + + +graph::Graph::number +_of_vertices + + + + + +Node1->Node4 + + + + + +Node6 + + +std::queue::pop + + + + + +Node1->Node6 + + + + + +Node7 + + +std::queue::push + + + + + +Node1->Node7 + + + + + +Node5 + + +std::vector::size + + + + + +Node4->Node5 + + + + + diff --git a/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.map b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.map new file mode 100644 index 000000000..ec33d449f --- /dev/null +++ b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.md5 b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.md5 new file mode 100644 index 000000000..b5b6dd7d2 --- /dev/null +++ b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.md5 @@ -0,0 +1 @@ +bd547a89ac56ae089298b3a8c71cefc7 \ No newline at end of file diff --git a/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.svg b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.svg new file mode 100644 index 000000000..8a36d43d0 --- /dev/null +++ b/d1/d71/classgraph_1_1_lowest_common_ancestor__coll__graph.svg @@ -0,0 +1,94 @@ + + + + + + +graph::LowestCommonAncestor + + + +Node1 + + +graph::LowestCommonAncestor + + + + + +Node2 + + +std::vector< std::vector +< int > > + + + + + +Node2->Node1 + + + up + + + +Node4 + + +graph::Graph + + + + + +Node2->Node4 + + + neighbors + + + +Node3 + + +graph::RootedTree + + + + + +Node3->Node1 + + + tree + + + +Node4->Node3 + + + + + +Node5 + + +std::vector< int > + + + + + +Node5->Node3 + + + parent +level + + + diff --git a/d4/d86/large__number_8h_source.html b/d4/d86/large__number_8h_source.html index f868421aa..f45db4ea7 100644 --- a/d4/d86/large__number_8h_source.html +++ b/d4/d86/large__number_8h_source.html @@ -412,10 +412,12 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
std::string
STL class.
std::equal
T equal(T... args)
std::shared_ptr
STL class.
+
graph::Graph::Graph
Graph(size_t N, const std::vector< std::pair< int, int > > &undirected_edges)
Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid v...
Definition: lowest_common_ancestor.cpp:61
MAX
#define MAX
Definition: fibonacci_fast.cpp:27
Graph::addVertices
void addVertices(unsigned int num=1)
Definition: cycle_check_directed_graph.cpp:118
test1
bool test1()
Definition: large_factorial.cpp:17
std::list
STL class.
+
graph::LowestCommonAncestor::LowestCommonAncestor
LowestCommonAncestor(const RootedTree &tree_)
Stores the tree and precomputs "up lifts".
Definition: lowest_common_ancestor.cpp:151
std::inner_product
T inner_product(T... args)
linear_probing::Entry::Entry
Entry(int key=notPresent)
constructor
Definition: linear_probing_hash_table.cpp:36
std::clock_t
@@ -432,6 +434,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
double_hashing
An implementation of hash table using double hashing algorithm.
linear_probing::Entry
Definition: linear_probing_hash_table.cpp:35
std::pair
+
graph::RootedTree::level
std::vector< int > level
Stores the distance from the root.
Definition: lowest_common_ancestor.cpp:105
double_factorial_iterative
uint64_t double_factorial_iterative(uint64_t n)
Definition: double_factorial.cpp:17
double_hashing::removalInfo
void removalInfo(int key)
Definition: double_hash_hash_table.cpp:227
hash_chain::find
bool find(int x, int h) const
Find if a value and corresponding hash exist.
Definition: chaining.cpp:101
@@ -462,6 +465,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
main
int main(int argc, char **argv)
Definition: spirograph.cpp:268
Complex::Complex
Complex(const Complex &other)
Copy Constructor.
Definition: complex_numbers.cpp:58
std::queue::emplace
T emplace(T... args)
+
graph::LowestCommonAncestor::populate_up
void populate_up()
Definition: lowest_common_ancestor.cpp:212
Complex::Complex
Complex(double x=0.f, double y=0.f, bool is_polar=false)
Complex Constructor which initialises our complex number.
Definition: complex_numbers.cpp:43
std::stringstream
STL class.
Complex::abs
double abs() const
Member function to give the modulus of our complex number. Member function to which gives the absolut...
Definition: complex_numbers.cpp:79
@@ -472,6 +476,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
gcd
int gcd(int num1, int num2)
Definition: gcd_recursive_euclidean.cpp:14
large_number.h
Library to perform arithmatic operations on arbitrarily large numbers.
node
Definition: avltree.cpp:13
+
graph::RootedTree
Definition: lowest_common_ancestor.cpp:84
get_rand
double get_rand()
Function to get random numbers to generate our complex numbers for test.
Definition: complex_numbers.cpp:201
binExpo_alt
int binExpo_alt(int a, int b)
Definition: binary_exponent.cpp:42
graph::explore
void explore(int, vector< bool > &)
Utility function for depth first seach algorithm this function explores the vertex which is passed in...
Definition: connected_components.cpp:101
@@ -494,6 +499,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
linear_probing::searchingProber
bool searchingProber(const Entry &entry, int key)
Definition: linear_probing_hash_table.cpp:110
machine_learning::adaline::predict
int predict(const std::vector< double > &x, double *out=nullptr)
Definition: adaline_learning.cpp:95
tests
void tests()
Definition: complex_numbers.cpp:206
+
graph::RootedTree::populate_parents
void populate_parents()
Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm...
Definition: lowest_common_ancestor.cpp:116
machine_learning
Machine learning algorithms.
Complex::operator=
const Complex & operator=(const Complex &other)
Operator overload of '=' on Complex class. Operator overload to be able to copy RHS instance of Compl...
Definition: complex_numbers.cpp:160
std::strerror
T strerror(T... args)
@@ -522,7 +528,6 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
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
quadratic_probing::remove
void remove(int key)
Definition: quadratic_probing_hash_table.cpp:194
large_number::operator+=
large_number & operator+=(large_number n)
Definition: large_number.h:192
-
query
Definition: mo.cpp:6
linear_probing::linearProbe
int linearProbe(int key, bool searching)
Definition: linear_probing_hash_table.cpp:55
operator*
std::vector< std::vector< T > > operator*(std::vector< std::vector< T >> const &A, std::vector< std::vector< T >> const &B)
Definition: ordinary_least_squares_regressor.cpp:78
MAX_ITER
constexpr int MAX_ITER
Definition: adaline_learning.cpp:40
@@ -546,10 +551,12 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
test3
void test3()
Definition: kohonen_som_topology.cpp:537
createNode
node * createNode(int data)
Definition: avltree.cpp:21
CycleCheck
Definition: cycle_check_directed_graph.cpp:158
+
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:103
CycleCheck::isCyclicDFSHelper
static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)
Definition: cycle_check_directed_graph.cpp:170
large_number::operator*=
large_number & operator*=(const T n)
Definition: large_number.h:238
large_number::large_number
large_number()
Definition: large_number.h:27
main
int main()
Main function.
Definition: binary_exponent.cpp:55
+
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
main
int main()
Definition: line_segment_intersection.cpp:92
quadratic_probing::Entry::key
int key
key value
Definition: quadratic_probing_hash_table.cpp:39
@@ -570,6 +577,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
machine_learning::adaline::eta
const double eta
learning rate of the algorithm
Definition: adaline_learning.cpp:207
std::min_element
T min_element(T... args)
phiFunction
uint64_t phiFunction(uint64_t n)
Definition: eulers_totient_function.cpp:32
+
graph::Graph::neighbors
std::vector< std::vector< int > > neighbors
for each vertex it stores a list indicies of its neighbors
Definition: lowest_common_ancestor.cpp:78
double_hashing::hashFxn
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition: double_hash_hash_table.cpp:47
std::queue::pop
T pop(T... args)
std::stack::top
T top(T... args)
@@ -662,6 +670,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
hash_chain::next
std::shared_ptr< struct Node > next
pointer to the next node
Definition: chaining.cpp:23
graph::adj
vector< vector< int > > adj
adj stores adjacency list representation of graph
Definition: connected_components.cpp:40
large_number::operator==
friend bool operator==(large_number const &a, large_number const &b)
Definition: large_number.h:155
+
graph::LowestCommonAncestor
Definition: lowest_common_ancestor.cpp:145
machine_learning::adaline::operator<<
friend std::ostream & operator<<(std::ostream &out, const adaline &ada)
Definition: adaline_learning.cpp:76
std::exp
T exp(T... args)
std::vector::begin
T begin(T... args)
@@ -674,13 +683,16 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
machine_learning::MIN_DISTANCE
constexpr double MIN_DISTANCE
Definition: kohonen_som_topology.cpp:129
linear_probing::removalInfo
void removalInfo(int key)
Definition: linear_probing_hash_table.cpp:201
show
void show(const struct tower *const F, const struct tower *const T, const struct tower *const U)
Definition: tower_of_hanoi.cpp:19
+
graph::Graph::number_of_vertices
int number_of_vertices() const
Definition: lowest_common_ancestor.cpp:73
compare
Definition: huffman.cpp:28
std::ios_base::sync_with_stdio
T sync_with_stdio(T... args)
stack
Definition: stack.h:26
+
tests
static void tests()
Definition: lowest_common_ancestor.cpp:234
get_clock_diff
double get_clock_diff(clock_t start_t, clock_t end_t)
Definition: kohonen_som_topology.cpp:577
gcd
int gcd(int *a, int n)
Definition: gcd_of_n_numbers.cpp:15
double_hashing::add
void add(int key)
Definition: double_hash_hash_table.cpp:185
double_hashing::doubleHash
int doubleHash(int key, bool searching)
Performs double hashing to resolve collisions.
Definition: double_hash_hash_table.cpp:71
+
main
int main()
Definition: lowest_common_ancestor.cpp:256
main
int main()
Definition: fast_power.cpp:68
double_factorial_recursive
uint64_t double_factorial_recursive(uint64_t n)
Definition: double_factorial.cpp:30
graph
Graph algorithms.
@@ -688,6 +700,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
std::count
T count(T... args)
std::ptrdiff_t
Trie::search
bool search(const std::string &word)
Definition: trie_modern.cpp:132
+
graph::Graph
Definition: lowest_common_ancestor.cpp:52
std::fixed
T fixed(T... args)
Item
Definition: knapsack.cpp:4
main
int main()
Definition: linear_probing_hash_table.cpp:224
@@ -705,7 +718,6 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
std::complex
STL class.
std::stringstream::str
T str(T... args)
std::complex::imag
T imag(T... args)
-
lca
Definition: lca.cpp:10
large_number::large_number
large_number(int n)
Definition: large_number.h:39
std::make_pair
T make_pair(T... args)
std::time
T time(T... args)
@@ -722,6 +734,7 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
main
int main()
Definition: gcd_iterative_euclidean.cpp:47
std::max
T max(T... args)
test_2d_classes
void test_2d_classes(std::vector< std::valarray< double >> *data)
Definition: kohonen_som_topology.cpp:330
+
graph::RootedTree::root
int root
Index of the root vertex.
Definition: lowest_common_ancestor.cpp:107
std::range_error
STL class.
Point
Definition: line_segment_intersection.cpp:12
large_number::operator!=
friend bool operator!=(large_number const &a, large_number const &b)
Definition: large_number.h:168
@@ -736,7 +749,9 @@ $(document).ready(function(){initNavTree('d4/d86/large__number_8h_source.html','
Graph::addEdge
void addEdge(Edge const &edge)
Definition: cycle_check_directed_graph.cpp:124
fast_power_linear
double fast_power_linear(T a, T b)
Definition: fast_power.cpp:50
spirograph::spirograph
void spirograph(std::array< std::pair< double, double >, N > *points, double l, double k, double rot)
Definition: spirograph.cpp:70
+
graph::LowestCommonAncestor::lowest_common_ancestor
int lowest_common_ancestor(int u, int v) const
Query the structure to find the lowest common ancestor. Assumes that the provided numbers are valid i...
Definition: lowest_common_ancestor.cpp:164
std::cin
+
graph::LowestCommonAncestor::up
std::vector< std::vector< int > > up
for every vertex stores a list of its ancestors by powers of two For each vertex, the first element o...
Definition: lowest_common_ancestor.cpp:206
hash_chain::display
void display()
Display the chain.
Definition: chaining.cpp:63
Graph::Graph
Graph(unsigned int vertices, AdjList const &adjList)
Definition: cycle_check_directed_graph.cpp:68
large_number::operator++
large_number & operator++(int)
Definition: large_number.h:183
diff --git a/d4/dbd/structlca__coll__graph.map b/d4/dbd/structlca__coll__graph.map deleted file mode 100644 index be2ec48fe..000000000 --- a/d4/dbd/structlca__coll__graph.map +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/d4/dbd/structlca__coll__graph.md5 b/d4/dbd/structlca__coll__graph.md5 deleted file mode 100644 index 7918bfa7e..000000000 --- a/d4/dbd/structlca__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -d14c8be22877978195a9e43ea9c94e0e \ No newline at end of file diff --git a/d4/dbd/structlca__coll__graph.svg b/d4/dbd/structlca__coll__graph.svg deleted file mode 100644 index 0b1bdf0ca..000000000 --- a/d4/dbd/structlca__coll__graph.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - -lca - - - -Node1 - - -lca - - - - - -Node2 - - -std::vector< int > - - - - - -Node2->Node1 - - - adj - - - diff --git a/d5/d08/classgraph_1_1_graph__coll__graph.map b/d5/d08/classgraph_1_1_graph__coll__graph.map new file mode 100644 index 000000000..694438285 --- /dev/null +++ b/d5/d08/classgraph_1_1_graph__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d5/d08/classgraph_1_1_graph__coll__graph.md5 b/d5/d08/classgraph_1_1_graph__coll__graph.md5 new file mode 100644 index 000000000..67c295d9f --- /dev/null +++ b/d5/d08/classgraph_1_1_graph__coll__graph.md5 @@ -0,0 +1 @@ +5c18b58932f5443083b287acc5b3ed7f \ No newline at end of file diff --git a/d5/d08/classgraph_1_1_graph__coll__graph.svg b/d5/d08/classgraph_1_1_graph__coll__graph.svg new file mode 100644 index 000000000..5c6d850ff --- /dev/null +++ b/d5/d08/classgraph_1_1_graph__coll__graph.svg @@ -0,0 +1,39 @@ + + + + + + +graph::Graph + + + +Node1 + + +graph::Graph + + + + + +Node2 + + +std::vector< std::vector +< int > > + + + + + +Node2->Node1 + + + neighbors + + + diff --git a/d5/d55/classgraph_1_1_rooted_tree-members.html b/d5/d55/classgraph_1_1_rooted_tree-members.html new file mode 100644 index 000000000..dc0877ca2 --- /dev/null +++ b/d5/d55/classgraph_1_1_rooted_tree-members.html @@ -0,0 +1,119 @@ + + + + + + + +Algorithms_in_C++: Member List + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ +  1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
graph::RootedTree Member List
+
+
+ +

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

+ + + + + + + + + +
Graph(size_t N, const std::vector< std::pair< int, int > > &undirected_edges)graph::Graphinline
levelgraph::RootedTree
neighborsgraph::Graph
number_of_vertices() constgraph::Graphinline
parentgraph::RootedTree
populate_parents()graph::RootedTreeinlineprotected
rootgraph::RootedTree
RootedTree(const std::vector< std::pair< int, int > > &undirected_edges, int root_)graph::RootedTreeinline
+
+ + + + diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index b207f11e3..3abeefbce 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -192,7 +192,7 @@ Graph
  • Hamiltons Cycle
  • Kosaraju
  • Kruskal
  • -
  • Lca
  • +
  • Lowest Common Ancestor
  • Max Flow With Ford Fulkerson And Edmond Karp Algo
  • Prim
  • Topological Sort
  • diff --git a/d7/dc1/classgraph_1_1_graph__inherit__graph.map b/d7/dc1/classgraph_1_1_graph__inherit__graph.map new file mode 100644 index 000000000..2ac032969 --- /dev/null +++ b/d7/dc1/classgraph_1_1_graph__inherit__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d7/dc1/classgraph_1_1_graph__inherit__graph.md5 b/d7/dc1/classgraph_1_1_graph__inherit__graph.md5 new file mode 100644 index 000000000..6693f7b8f --- /dev/null +++ b/d7/dc1/classgraph_1_1_graph__inherit__graph.md5 @@ -0,0 +1 @@ +1a9b4fcdd12e5e4774146501e35513f2 \ No newline at end of file diff --git a/d7/dc1/classgraph_1_1_graph__inherit__graph.svg b/d7/dc1/classgraph_1_1_graph__inherit__graph.svg new file mode 100644 index 000000000..ab7c05e42 --- /dev/null +++ b/d7/dc1/classgraph_1_1_graph__inherit__graph.svg @@ -0,0 +1,37 @@ + + + + + + +graph::Graph + + + +Node1 + + +graph::Graph + + + + + +Node2 + + +graph::RootedTree + + + + + +Node1->Node2 + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor.html b/d9/d23/classgraph_1_1_lowest_common_ancestor.html new file mode 100644 index 000000000..7fd6ff1c7 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor.html @@ -0,0 +1,334 @@ + + + + + + + +Algorithms_in_C++: graph::LowestCommonAncestor Class Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ +  1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    graph::LowestCommonAncestor Class Reference
    +
    +
    +
    +Collaboration diagram for graph::LowestCommonAncestor:
    +
    +
    +
    +
    [legend]
    + + + + + + + + +

    +Public Member Functions

     LowestCommonAncestor (const RootedTree &tree_)
     Stores the tree and precomputs "up lifts". More...
     
    int lowest_common_ancestor (int u, int v) const
     Query the structure to find the lowest common ancestor. Assumes that the provided numbers are valid indices of vertices. Iterativelly modifies ("lifts") u an v until it finnds their lowest common ancestor. More...
     
    + + + + + + +

    +Public Attributes

    +const RootedTreetree
     
    +std::vector< std::vector< int > > up
     for every vertex stores a list of its ancestors by powers of two For each vertex, the first element of the corresponding list contains the index of its parent. The i-th element of the list is an index of the (2^i)-th ancestor of the vertex.
     
    + + + +

    +Protected Member Functions

    void populate_up ()
     
    +

    Detailed Description

    +

    A structure that holds a rooted tree and allow for effecient queries of the lowest common ancestor of two given vertices in the tree.

    +

    Constructor & Destructor Documentation

    + +

    ◆ LowestCommonAncestor()

    + +
    +
    + + + + + +
    + + + + + + + + +
    graph::LowestCommonAncestor::LowestCommonAncestor (const RootedTreetree_)
    +
    +inlineexplicit
    +
    + +

    Stores the tree and precomputs "up lifts".

    +
    Parameters
    + + +
    tree_rooted tree.
    +
    +
    +
    151  : tree(tree_) {
    +
    152  populate_up();
    +
    153  }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +

    Member Function Documentation

    + +

    ◆ lowest_common_ancestor()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + +
    int graph::LowestCommonAncestor::lowest_common_ancestor (int u,
    int v 
    ) const
    +
    +inline
    +
    + +

    Query the structure to find the lowest common ancestor. Assumes that the provided numbers are valid indices of vertices. Iterativelly modifies ("lifts") u an v until it finnds their lowest common ancestor.

    +
    Parameters
    + + + +
    uindex of one of the queried vertex
    vindex of the other queried vertex
    +
    +
    +
    Returns
    index of the vertex which is the lowet common ancestor of u and v
    +
    164  {
    +
    165  // Ensure u is the deeper (higher level) of the two vertices
    +
    166  if (tree.level[v] > tree.level[u]) {
    +
    167  std::swap(u, v);
    +
    168  }
    +
    169 
    +
    170  // "Lift" u to the same level as v.
    +
    171  int level_diff = tree.level[u] - tree.level[v];
    +
    172  for (int i = 0; (1 << i) <= level_diff; ++i) {
    +
    173  if (level_diff & (1 << i)) {
    +
    174  u = up[u][i];
    +
    175  }
    +
    176  }
    +
    177  assert(tree.level[u] == tree.level[v]);
    +
    178 
    +
    179  if (u == v) {
    +
    180  return u;
    +
    181  }
    +
    182 
    +
    183  // "Lift" u and v to their 2^i th ancestor if they are different
    +
    184  for (int i = static_cast<int>(up[u].size()) - 1; i >= 0; --i) {
    +
    185  if (up[u][i] != up[v][i]) {
    +
    186  u = up[u][i];
    +
    187  v = up[v][i];
    +
    188  }
    +
    189  }
    +
    190 
    +
    191  // As we regressed u an v such that they cannot further be lifted so
    +
    192  // that their ancestor would be different, the only logical
    +
    193  // consequence is that their parent is the sought answer.
    +
    194  assert(up[u][0] == up[v][0]);
    +
    195  return up[u][0];
    +
    196  }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ populate_up()

    + +
    +
    + + + + + +
    + + + + + + + +
    void graph::LowestCommonAncestor::populate_up ()
    +
    +inlineprotected
    +
    +

    Populate the "up" structure. See above.

    +
    212  {
    +
    213  up.resize(tree.number_of_vertices());
    +
    214  for (int vertex = 0; vertex < tree.number_of_vertices(); ++vertex) {
    +
    215  up[vertex].push_back(tree.parent[vertex]);
    +
    216  }
    +
    217  for (int level = 0; (1 << level) < tree.number_of_vertices(); ++level) {
    +
    218  for (int vertex = 0; vertex < tree.number_of_vertices(); ++vertex) {
    +
    219  // up[vertex][level + 1] = 2^(level + 1) th ancestor of vertex =
    +
    220  // = 2^level th ancestor of 2^level th ancestor of vertex =
    +
    221  // = 2^level th ancestor of up[vertex][level]
    +
    222  up[vertex].push_back(up[up[vertex][level]][level]);
    +
    223  }
    +
    224  }
    +
    225  }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +
    The documentation for this class was generated from the following file: +
    +
    +
    std::vector::resize
    T resize(T... args)
    +
    graph::RootedTree::level
    std::vector< int > level
    Stores the distance from the root.
    Definition: lowest_common_ancestor.cpp:105
    +
    graph::LowestCommonAncestor::populate_up
    void populate_up()
    Definition: lowest_common_ancestor.cpp:212
    +
    std::vector::push_back
    T push_back(T... args)
    +
    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:103
    +
    std::swap
    T swap(T... args)
    +
    graph::Graph::number_of_vertices
    int number_of_vertices() const
    Definition: lowest_common_ancestor.cpp:73
    +
    graph::LowestCommonAncestor::up
    std::vector< std::vector< int > > up
    for every vertex stores a list of its ancestors by powers of two For each vertex, the first element o...
    Definition: lowest_common_ancestor.cpp:206
    + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor.js b/d9/d23/classgraph_1_1_lowest_common_ancestor.js new file mode 100644 index 000000000..2c5c414f3 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor.js @@ -0,0 +1,8 @@ +var classgraph_1_1_lowest_common_ancestor = +[ + [ "LowestCommonAncestor", "d9/d23/classgraph_1_1_lowest_common_ancestor.html#a80825a4fd4c41860b689d253dd2c8e93", null ], + [ "lowest_common_ancestor", "d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488", null ], + [ "populate_up", "d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356", null ], + [ "tree", "d9/d23/classgraph_1_1_lowest_common_ancestor.html#ad6ae1f39c3ce27fc009970e6aa3c022a", null ], + [ "up", "d9/d23/classgraph_1_1_lowest_common_ancestor.html#ad2032148b2443f5b6a0d01e4519d6898", null ] +]; \ No newline at end of file diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.map b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.map new file mode 100644 index 000000000..f9283a27b --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.md5 b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.md5 new file mode 100644 index 000000000..3651593b7 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.md5 @@ -0,0 +1 @@ +832cdd79cd298ba0f0e23035bd473a9f \ No newline at end of file diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.svg b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.svg new file mode 100644 index 000000000..b314ca026 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a42589cc39d6bbff6c997152f1b96e356_cgraph.svg @@ -0,0 +1,84 @@ + + + + + + +graph::LowestCommonAncestor::populate_up + + + +Node1 + + +graph::LowestCommonAncestor +::populate_up + + + + + +Node2 + + +graph::Graph::number +_of_vertices + + + + + +Node1->Node2 + + + + + +Node4 + + +std::vector::push_back + + + + + +Node1->Node4 + + + + + +Node5 + + +std::vector::resize + + + + + +Node1->Node5 + + + + + +Node3 + + +std::vector::size + + + + + +Node2->Node3 + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.map b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.map new file mode 100644 index 000000000..201bbd13d --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.md5 b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.md5 new file mode 100644 index 000000000..fd3e960ad --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.md5 @@ -0,0 +1 @@ +6160ae8a35a7fff40af895010fdb61e2 \ No newline at end of file diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.svg b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.svg new file mode 100644 index 000000000..8ea44a935 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a60151e19512b48cc0b14ea121df00488_cgraph.svg @@ -0,0 +1,38 @@ + + + + + + +graph::LowestCommonAncestor::lowest_common_ancestor + + + +Node1 + + +graph::LowestCommonAncestor +::lowest_common_ancestor + + + + + +Node2 + + +std::swap + + + + + +Node1->Node2 + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.map b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.map new file mode 100644 index 000000000..b198d40e0 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.md5 b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.md5 new file mode 100644 index 000000000..1a956ef5a --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.md5 @@ -0,0 +1 @@ +80f5cb55c94a6507710a932c448232ff \ No newline at end of file diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.svg b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.svg new file mode 100644 index 000000000..c6590c46f --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +graph::LowestCommonAncestor::LowestCommonAncestor + + + +Node1 + + +graph::LowestCommonAncestor +::LowestCommonAncestor + + + + + +Node2 + + +graph::LowestCommonAncestor +::populate_up + + + + + +Node1->Node2 + + + + + +Node3 + + +graph::Graph::number +_of_vertices + + + + + +Node2->Node3 + + + + + +Node5 + + +std::vector::push_back + + + + + +Node2->Node5 + + + + + +Node6 + + +std::vector::resize + + + + + +Node2->Node6 + + + + + +Node4 + + +std::vector::size + + + + + +Node3->Node4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph_org.svg b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph_org.svg new file mode 100644 index 000000000..2312b5793 --- /dev/null +++ b/d9/d23/classgraph_1_1_lowest_common_ancestor_a80825a4fd4c41860b689d253dd2c8e93_cgraph_org.svg @@ -0,0 +1,100 @@ + + + + + + +graph::LowestCommonAncestor::LowestCommonAncestor + + + +Node1 + + +graph::LowestCommonAncestor +::LowestCommonAncestor + + + + + +Node2 + + +graph::LowestCommonAncestor +::populate_up + + + + + +Node1->Node2 + + + + + +Node3 + + +graph::Graph::number +_of_vertices + + + + + +Node2->Node3 + + + + + +Node5 + + +std::vector::push_back + + + + + +Node2->Node5 + + + + + +Node6 + + +std::vector::resize + + + + + +Node2->Node6 + + + + + +Node4 + + +std::vector::size + + + + + +Node3->Node4 + + + + + diff --git a/d5/dc2/structlca-members.html b/da/d73/classgraph_1_1_lowest_common_ancestor-members.html similarity index 62% rename from d5/dc2/structlca-members.html rename to da/d73/classgraph_1_1_lowest_common_ancestor-members.html index e739d1a7b..ce6a72b1b 100644 --- a/d5/dc2/structlca-members.html +++ b/da/d73/classgraph_1_1_lowest_common_ancestor-members.html @@ -71,7 +71,7 @@ $(function() {
    @@ -91,21 +91,17 @@ $(document).ready(function(){initNavTree('dd/df4/structlca.html','../../'); init
    -
    lca Member List
    +
    graph::LowestCommonAncestor Member List
    -

    This is the complete list of members for lca, including all inherited members.

    +

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

    - - - - - - - - - + + + + +
    adj (defined in lca)lca
    build() (defined in lca)lcainline
    dfs(int node, int par) (defined in lca)lcainline
    lca(int n_) (defined in lca)lcainline
    level (defined in lca)lca
    n (defined in lca)lca
    query(int u, int v) (defined in lca)lcainline
    up (defined in lca)lca
    verify() (defined in lca)lcainline
    lowest_common_ancestor(int u, int v) constgraph::LowestCommonAncestorinline
    LowestCommonAncestor(const RootedTree &tree_)graph::LowestCommonAncestorinlineexplicit
    populate_up()graph::LowestCommonAncestorinlineprotected
    tree (defined in graph::LowestCommonAncestor)graph::LowestCommonAncestor
    upgraph::LowestCommonAncestor
    diff --git a/db/d1e/classgraph_1_1_graph-members.html b/db/d1e/classgraph_1_1_graph-members.html new file mode 100644 index 000000000..741c8096e --- /dev/null +++ b/db/d1e/classgraph_1_1_graph-members.html @@ -0,0 +1,114 @@ + + + + + + + +Algorithms_in_C++: Member List + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ +  1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    graph::Graph Member List
    +
    +
    + +

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

    + + + + +
    Graph(size_t N, const std::vector< std::pair< int, int > > &undirected_edges)graph::Graphinline
    neighborsgraph::Graph
    number_of_vertices() constgraph::Graphinline
    +
    + + + + diff --git a/db/d8e/lowest__common__ancestor_8cpp__incl.map b/db/d8e/lowest__common__ancestor_8cpp__incl.map new file mode 100644 index 000000000..c8bb3606e --- /dev/null +++ b/db/d8e/lowest__common__ancestor_8cpp__incl.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/db/d8e/lowest__common__ancestor_8cpp__incl.md5 b/db/d8e/lowest__common__ancestor_8cpp__incl.md5 new file mode 100644 index 000000000..ec41b16f6 --- /dev/null +++ b/db/d8e/lowest__common__ancestor_8cpp__incl.md5 @@ -0,0 +1 @@ +feebcb6a27d1da6fc5957bddbf9dee90 \ No newline at end of file diff --git a/db/d8e/lowest__common__ancestor_8cpp__incl.svg b/db/d8e/lowest__common__ancestor_8cpp__incl.svg new file mode 100644 index 000000000..e7b2200c9 --- /dev/null +++ b/db/d8e/lowest__common__ancestor_8cpp__incl.svg @@ -0,0 +1,98 @@ + + + + + + +graph/lowest_common_ancestor.cpp + + + +Node1 + + +graph/lowest_common +_ancestor.cpp + + + + + +Node2 + + +iostream + + + + + +Node1->Node2 + + + + + +Node3 + + +utility + + + + + +Node1->Node3 + + + + + +Node4 + + +vector + + + + + +Node1->Node4 + + + + + +Node5 + + +queue + + + + + +Node1->Node5 + + + + + +Node6 + + +cassert + + + + + +Node1->Node6 + + + + + diff --git a/dc/d61/classgraph_1_1_graph.html b/dc/d61/classgraph_1_1_graph.html new file mode 100644 index 000000000..a905ef2d0 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph.html @@ -0,0 +1,245 @@ + + + + + + + +Algorithms_in_C++: graph::Graph Class Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ +  1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    graph::Graph Class Reference
    +
    +
    +
    +Inheritance diagram for graph::Graph:
    +
    +
    +
    +
    [legend]
    +
    +Collaboration diagram for graph::Graph:
    +
    +
    +
    +
    [legend]
    + + + + + + + +

    +Public Member Functions

     Graph (size_t N, const std::vector< std::pair< int, int > > &undirected_edges)
     Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid vertex indices. More...
     
    int number_of_vertices () const
     
    + + + + +

    +Public Attributes

    +std::vector< std::vector< int > > neighbors
     for each vertex it stores a list indicies of its neighbors
     
    +

    Detailed Description

    +

    Class for representing a graph as an adjacency list. Its vertices are indexed 0, 1, ..., N - 1.

    +

    Constructor & Destructor Documentation

    + +

    ◆ Graph()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + +
    graph::Graph::Graph (size_t N,
    const std::vector< std::pair< int, int > > & undirected_edges 
    )
    +
    +inline
    +
    + +

    Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid vertex indices.

    +
    Parameters
    + + + +
    Nnumber of vertices in the graph
    undirected_edgeslist of graph's undirected edges
    +
    +
    +
    61  {
    +
    62  neighbors.resize(N);
    +
    63  for (auto &edge : undirected_edges) {
    +
    64  neighbors[edge.first].push_back(edge.second);
    +
    65  neighbors[edge.second].push_back(edge.first);
    +
    66  }
    +
    67  }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +

    Member Function Documentation

    + +

    ◆ number_of_vertices()

    + +
    +
    + + + + + +
    + + + + + + + +
    int graph::Graph::number_of_vertices () const
    +
    +inline
    +
    +

    Function to get the number of vertices in the graph

    Returns
    the number of vertices in the graph.
    +
    73  {
    +
    74  return neighbors.size();
    +
    75  }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +
    The documentation for this class was generated from the following file: +
    +
    +
    std::vector::resize
    T resize(T... args)
    +
    std::vector::size
    T size(T... args)
    +
    std::vector::push_back
    T push_back(T... args)
    +
    graph::Graph::neighbors
    std::vector< std::vector< int > > neighbors
    for each vertex it stores a list indicies of its neighbors
    Definition: lowest_common_ancestor.cpp:78
    + + + + diff --git a/dc/d61/classgraph_1_1_graph.js b/dc/d61/classgraph_1_1_graph.js new file mode 100644 index 000000000..e8e564116 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph.js @@ -0,0 +1,6 @@ +var classgraph_1_1_graph = +[ + [ "Graph", "dc/d61/classgraph_1_1_graph.html#a34414f67c2e3ea89774839b36b1575f8", null ], + [ "number_of_vertices", "dc/d61/classgraph_1_1_graph.html#ae2f6992450faa2c3da93edea0818869a", null ], + [ "neighbors", "dc/d61/classgraph_1_1_graph.html#aee72d7dd4778097a6d852c659de8fe58", null ] +]; \ No newline at end of file diff --git a/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.map b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.map new file mode 100644 index 000000000..4c15d5827 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.md5 b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.md5 new file mode 100644 index 000000000..a65066fa8 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.md5 @@ -0,0 +1 @@ +e538c988bc33576564824cdee89b0e2a \ No newline at end of file diff --git a/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.svg b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.svg new file mode 100644 index 000000000..2d3ae56f8 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_a34414f67c2e3ea89774839b36b1575f8_cgraph.svg @@ -0,0 +1,52 @@ + + + + + + +graph::Graph::Graph + + + +Node1 + + +graph::Graph::Graph + + + + + +Node2 + + +std::vector::push_back + + + + + +Node1->Node2 + + + + + +Node3 + + +std::vector::resize + + + + + +Node1->Node3 + + + + + diff --git a/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.map b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.map new file mode 100644 index 000000000..674447c5a --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.md5 b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.md5 new file mode 100644 index 000000000..592b059e7 --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.md5 @@ -0,0 +1 @@ +f53c0fb8b60b21d44b94c1e93215a573 \ No newline at end of file diff --git a/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.svg b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.svg new file mode 100644 index 000000000..c92ab697f --- /dev/null +++ b/dc/d61/classgraph_1_1_graph_ae2f6992450faa2c3da93edea0818869a_cgraph.svg @@ -0,0 +1,38 @@ + + + + + + +graph::Graph::number_of_vertices + + + +Node1 + + +graph::Graph::number +_of_vertices + + + + + +Node2 + + +std::vector::size + + + + + +Node1->Node2 + + + + + diff --git a/dd/d9b/classgraph.html b/dd/d9b/classgraph.html index 7c963b6ce..fb5971db3 100644 --- a/dd/d9b/classgraph.html +++ b/dd/d9b/classgraph.html @@ -91,6 +91,7 @@ $(document).ready(function(){initNavTree('dd/d9b/classgraph.html','../../'); ini
    +Classes | Public Member Functions | Private Member Functions | Private Attributes | @@ -106,6 +107,15 @@ Collaboration diagram for graph:
    [legend]
    + + + + + + + +

    +Classes

    class  Graph
     
    class  LowestCommonAncestor
     
    class  RootedTree
     
    - +

    Public Member Functions

    diff --git a/dd/d9b/classgraph.js b/dd/d9b/classgraph.js index 37de31def..c23979709 100644 --- a/dd/d9b/classgraph.js +++ b/dd/d9b/classgraph.js @@ -1,5 +1,8 @@ var classgraph = [ + [ "Graph", "dc/d61/classgraph_1_1_graph.html", "dc/d61/classgraph_1_1_graph" ], + [ "LowestCommonAncestor", "d9/d23/classgraph_1_1_lowest_common_ancestor.html", "d9/d23/classgraph_1_1_lowest_common_ancestor" ], + [ "RootedTree", "d0/d58/classgraph_1_1_rooted_tree.html", "d0/d58/classgraph_1_1_rooted_tree" ], [ "graph", "dd/d9b/classgraph.html#a6da44f9820d3b7bae2f0f74bc149c27e", null ], [ "addEdge", "dd/d9b/classgraph.html#a35c12fba596d8bb48b1877b128c4ba6d", null ], [ "depth_first_search", "dd/d9b/classgraph.html#a135921a59082b669678b029b301b8a1c", null ], diff --git a/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.map b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.map new file mode 100644 index 000000000..bc1e78245 --- /dev/null +++ b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.md5 b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.md5 new file mode 100644 index 000000000..1b6322880 --- /dev/null +++ b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.md5 @@ -0,0 +1 @@ +872f17ab54284495ce1b233a79b27b93 \ No newline at end of file diff --git a/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.svg b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.svg new file mode 100644 index 000000000..3e7c51b15 --- /dev/null +++ b/dd/d9b/classgraph_1_1_rooted_tree__inherit__graph.svg @@ -0,0 +1,37 @@ + + + + + + +graph::RootedTree + + + +Node1 + + +graph::RootedTree + + + + + +Node2 + + +graph::Graph + + + + + +Node2->Node1 + + + + + diff --git a/dd/df4/structlca.html b/dd/df4/structlca.html deleted file mode 100644 index a846cc027..000000000 --- a/dd/df4/structlca.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - -Algorithms_in_C++: lca Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Algorithms_in_C++ -  1.0.0 -
    -
    Set of algorithms implemented in C++.
    -
    -
    - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    - -
    - - -
    -
    -Collaboration diagram for lca:
    -
    -
    -
    -
    [legend]
    - - - - - - - - - - - - -

    -Public Member Functions

    lca (int n_)
     
    -void verify ()
     
    -void build ()
     
    -void dfs (int node, int par)
     
    -int query (int u, int v)
     
    - - - - - - - - - -

    -Public Attributes

    -int n
     
    -vector< int > adj [N]
     
    -int up [LG][N]
     
    -int level [N]
     
    -
    The documentation for this struct was generated from the following file:
      -
    • graph/lca.cpp
    • -
    -
    -
    - - - - diff --git a/dd/df4/structlca.js b/dd/df4/structlca.js deleted file mode 100644 index f08b66df0..000000000 --- a/dd/df4/structlca.js +++ /dev/null @@ -1,12 +0,0 @@ -var structlca = -[ - [ "lca", "dd/df4/structlca.html#af1749a2effd0d3818ad6a788cdaa7428", null ], - [ "build", "dd/df4/structlca.html#ab8e51315d17f1dea5f868789c7728991", null ], - [ "dfs", "dd/df4/structlca.html#a32c8be06ce7ed44b643354f0c0ae47a6", null ], - [ "query", "dd/df4/structlca.html#a7570bbb77f84fbc1b53927b0c9696511", null ], - [ "verify", "dd/df4/structlca.html#ae4feede657d048b9ffa9e375d1c1f2f8", null ], - [ "adj", "dd/df4/structlca.html#a14b42cdfa4ea593bc0d0571c513c0e23", null ], - [ "level", "dd/df4/structlca.html#a2a794275904ce312065fea07e362aaef", null ], - [ "n", "dd/df4/structlca.html#a1db0a3861d8cb6b3da785646654adb1c", null ], - [ "up", "dd/df4/structlca.html#ae53b8b2b47baa0097c6e3186279b154b", null ] -]; \ No newline at end of file diff --git a/de/dde/lowest__common__ancestor_8cpp.html b/de/dde/lowest__common__ancestor_8cpp.html new file mode 100644 index 000000000..f0caeb14f --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp.html @@ -0,0 +1,262 @@ + + + + + + + +Algorithms_in_C++: graph/lowest_common_ancestor.cpp File Reference + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Algorithms_in_C++ +  1.0.0 +
    +
    Set of algorithms implemented in C++.
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    lowest_common_ancestor.cpp File Reference
    +
    +
    + +

    Data structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting. +More...

    +
    #include <iostream>
    +#include <utility>
    +#include <vector>
    +#include <queue>
    +#include <cassert>
    +
    +Include dependency graph for lowest_common_ancestor.cpp:
    +
    +
    +
    +
    +
    + + + + + + + +

    +Classes

    class  graph::Graph
     
    class  graph::RootedTree
     
    class  graph::LowestCommonAncestor
     
    + + + + +

    +Namespaces

     graph
     Graph algorithms.
     
    + + + + + +

    +Functions

    static void tests ()
     
    int main ()
     
    +

    Detailed Description

    +

    Data structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting.

    +

    Algorithm: https://cp-algorithms.com/graph/lca_binary_lifting.html

    +

    Complexity:

      +
    • Precomputation: \(O(N \log N)\) where \(N\) is the number of vertices in the tree
    • +
    • Query: \(O(\log N)\)
    • +
    • Space: \(O(N \log N)\)
    • +
    +

    Example:
    + Tree:

    +            _  3  _
    +         /     |     \
    +       1       6       4
    +     / |     /   \       \
    +   7   5   2       8       0
    +           |
    +           9
    +


    + lowest_common_ancestor(7, 4) = 3
    + lowest_common_ancestor(9, 6) = 6
    + lowest_common_ancestor(0, 0) = 0
    + lowest_common_ancestor(8, 2) = 6

    +

    The query is symmetrical, therefore lowest_common_ancestor(x, y) = lowest_common_ancestor(y, x)

    +

    Function Documentation

    + +

    ◆ main()

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

    Main function

    +
    256  {
    +
    257  tests();
    +
    258  return 0;
    +
    259 }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    + +

    ◆ tests()

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

    Unit tests @rerturns none

    +
         _  3  _
    +  /     |     \
    +1       6       4
    +

    / | / \ \ 7 5 2 8 0 | 9

    +
    234  {
    +
    235  /**
    +
    236  * _ 3 _
    +
    237  * / | \
    +
    238  * 1 6 4
    +
    239  * / | / \ \
    +
    240  * 7 5 2 8 0
    +
    241  * |
    +
    242  * 9
    +
    243  */
    + +
    245  {7, 1}, {1, 5}, {1, 3}, {3, 6}, {6, 2}, {2, 9}, {6, 8}, {4, 3}, {0, 4}
    +
    246  };
    +
    247  graph::RootedTree t(edges, 3);
    + +
    249  assert(lca.lowest_common_ancestor(7, 4) == 3);
    +
    250  assert(lca.lowest_common_ancestor(9, 6) == 6);
    +
    251  assert(lca.lowest_common_ancestor(0, 0) == 0);
    +
    252  assert(lca.lowest_common_ancestor(8, 2) == 6);
    +
    253 }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    STL class.
    +
    Definition: lowest_common_ancestor.cpp:84
    +
    Definition: lowest_common_ancestor.cpp:145
    +
    static void tests()
    Definition: lowest_common_ancestor.cpp:234
    + + + + diff --git a/de/dde/lowest__common__ancestor_8cpp.js b/de/dde/lowest__common__ancestor_8cpp.js new file mode 100644 index 000000000..374da3573 --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp.js @@ -0,0 +1,8 @@ +var lowest__common__ancestor_8cpp = +[ + [ "Graph", "dc/d61/classgraph_1_1_graph.html", "dc/d61/classgraph_1_1_graph" ], + [ "RootedTree", "d0/d58/classgraph_1_1_rooted_tree.html", "d0/d58/classgraph_1_1_rooted_tree" ], + [ "LowestCommonAncestor", "d9/d23/classgraph_1_1_lowest_common_ancestor.html", "d9/d23/classgraph_1_1_lowest_common_ancestor" ], + [ "main", "de/dde/lowest__common__ancestor_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "tests", "de/dde/lowest__common__ancestor_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e", null ] +]; \ No newline at end of file diff --git a/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map new file mode 100644 index 000000000..02ffdc0ed --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 new file mode 100644 index 000000000..d5d520671 --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 @@ -0,0 +1 @@ +2c0917ba04abf4d2d5a288943459e543 \ No newline at end of file diff --git a/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg new file mode 100644 index 000000000..ab0da83b4 --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg @@ -0,0 +1,53 @@ + + + + + + +tests + + + +Node1 + + +tests + + + + + +Node2 + + +graph::LowestCommonAncestor +::lowest_common_ancestor + + + + + +Node1->Node2 + + + + + +Node3 + + +std::swap + + + + + +Node2->Node3 + + + + + diff --git a/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..d92952084 --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..eab3a94a3 --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +5ed5314781633e24099a48690e85f137 \ No newline at end of file diff --git a/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..c60990d5d --- /dev/null +++ b/de/dde/lowest__common__ancestor_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,68 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +tests + + + + + +Node1->Node2 + + + + + +Node3 + + +graph::LowestCommonAncestor +::lowest_common_ancestor + + + + + +Node2->Node3 + + + + + +Node4 + + +std::swap + + + + + +Node3->Node4 + + + + + diff --git a/df/d82/breadth__first__search_8cpp.html b/df/d82/breadth__first__search_8cpp.html index 6552292e9..9b96cef6c 100644 --- a/df/d82/breadth__first__search_8cpp.html +++ b/df/d82/breadth__first__search_8cpp.html @@ -115,7 +115,7 @@ Include dependency graph for breadth_first_search.cpp:

    Namespaces

     graph
     Graph algorithms.
     Graph algorithms.
     
    + + +

    diff --git a/df/dce/namespacegraph.html b/df/dce/namespacegraph.html index 33108873c..22f830eec 100644 --- a/df/dce/namespacegraph.html +++ b/df/dce/namespacegraph.html @@ -97,7 +97,7 @@ $(document).ready(function(){initNavTree('df/dce/namespacegraph.html','../../');
    -

    Graph algorithms. +

    Graph algorithms. More...

    @@ -113,7 +113,7 @@ Functions

     

    Detailed Description

    -

    Graph algorithms.

    +

    Graph algorithms.

    Function Documentation

    ◆ add_directed_edge()

    diff --git a/dir_12552d7fa429bf94a2e32e5cf39f7e69.html b/dir_12552d7fa429bf94a2e32e5cf39f7e69.html index 4d984d828..04799665b 100644 --- a/dir_12552d7fa429bf94a2e32e5cf39f7e69.html +++ b/dir_12552d7fa429bf94a2e32e5cf39f7e69.html @@ -106,6 +106,9 @@ Files

    file  hamiltons_cycle.cpp
     The implementation of Hamilton's cycle dynamic solution for vertices number less than 20.
     
    file  lowest_common_ancestor.cpp
     Data structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting.
     
    diff --git a/dir_12552d7fa429bf94a2e32e5cf39f7e69.js b/dir_12552d7fa429bf94a2e32e5cf39f7e69.js index accd3a141..0158cc9d9 100644 --- a/dir_12552d7fa429bf94a2e32e5cf39f7e69.js +++ b/dir_12552d7fa429bf94a2e32e5cf39f7e69.js @@ -2,5 +2,6 @@ var dir_12552d7fa429bf94a2e32e5cf39f7e69 = [ [ "breadth_first_search.cpp", "df/d82/breadth__first__search_8cpp.html", "df/d82/breadth__first__search_8cpp" ], [ "connected_components.cpp", "df/ddd/connected__components_8cpp.html", "df/ddd/connected__components_8cpp" ], - [ "hamiltons_cycle.cpp", "dd/d0c/hamiltons__cycle_8cpp.html", "dd/d0c/hamiltons__cycle_8cpp" ] + [ "hamiltons_cycle.cpp", "dd/d0c/hamiltons__cycle_8cpp.html", "dd/d0c/hamiltons__cycle_8cpp" ], + [ "lowest_common_ancestor.cpp", "de/dde/lowest__common__ancestor_8cpp.html", "de/dde/lowest__common__ancestor_8cpp" ] ]; \ No newline at end of file diff --git a/files.html b/files.html index 6d2fa3ff3..8816313ab 100644 --- a/files.html +++ b/files.html @@ -127,6 +127,7 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });  breadth_first_search.cppBreadth First Search Algorithm (Breadth First Search)  connected_components.cppGraph Connected Components (Connected Components)  hamiltons_cycle.cppThe implementation of Hamilton's cycle dynamic solution for vertices number less than 20 + lowest_common_ancestor.cppData structure for finding the lowest common ancestor of two vertices in a rooted tree using binary lifting   graphics  spirograph.cppImplementation of Spirograph   hashing diff --git a/functions.html b/functions.html index 244db6fec..d997c52e9 100644 --- a/functions.html +++ b/functions.html @@ -286,7 +286,7 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable(); : graph
  • Graph() -: Graph +: graph::Graph
  • @@ -367,6 +367,13 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  • level : data_structure::SkipList +, graph::RootedTree +
  • +
  • lowest_common_ancestor() +: graph::LowestCommonAncestor +
  • +
  • LowestCommonAncestor() +: graph::LowestCommonAncestor
  • @@ -392,6 +399,9 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();

    - n -

    @@ -469,12 +482,21 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();

    - p -

    @@ -563,6 +591,9 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();

    - u -

    @@ -309,6 +310,12 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
  • left() : MinHeap
  • +
  • lowest_common_ancestor() +: graph::LowestCommonAncestor +
  • +
  • LowestCommonAncestor() +: graph::LowestCommonAncestor +
  • @@ -343,6 +350,9 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
  • num_digits() : large_number
  • +
  • number_of_vertices() +: graph::Graph +
  • @@ -395,6 +405,12 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
  • pop() : stack< Type >
  • +
  • populate_parents() +: graph::RootedTree +
  • +
  • populate_up() +: graph::LowestCommonAncestor +
  • predict() : machine_learning::adaline
  • @@ -427,6 +443,9 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
  • right() : MinHeap
  • +
  • RootedTree() +: graph::RootedTree +
  • diff --git a/functions_vars.html b/functions_vars.html index 052eea834..6274fd279 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -173,11 +173,15 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl

    - l -

    - n -

    +

    - p -

    + +

    - q -

    +

    - r -

    + +

    - s -

    +

    - u -

    + +

    - v -