|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Educational examples for arc indexing (fast arc lookup) More...
Go to the source code of this file.
Functions | |
| int | main () |
Educational examples for arc indexing (fast arc lookup)
Maintains a binary search tree of arcs indexed by (source, target) pair Enables O(log m) arc search instead of O(degree) iteration Essential for dense graphs where degree is large
"Does arc exist from node A to node B?" Without index: Iterate through all arcs of A - O(degree) With index: Binary search tree lookup - O(log m)
g++ -std=c++20 -I.. -o tpl_indexArc_example tpl_indexArc_example.cc ./tpl_indexArc_example
Definition in file tpl_indexArc_example.cc.
| int main | ( | ) |
Definition at line 37 of file tpl_indexArc_example.cc.
References Aleph::DynList< T >::append(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), log2(), Aleph::maps(), N, and nodes.