|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Modules | |
| C++20 Concepts for Graph Iterators | |
| These concepts define the interface contracts for Aleph-w graph iterators. | |
Files | |
| file | ah-graph-concepts.H |
| C++20 concepts for the protocol shared by graph algorithms. | |
| file | aleph-graph.H |
| Simplified graph interface for common use cases. | |
| file | archeap.H |
| Arc heap for graph algorithms. | |
| file | AStar.H |
| A* shortest path algorithm. | |
| file | Bellman_Ford.H |
| Bellman-Ford algorithm for single-source shortest paths. | |
| file | Bidirectional_BFS.H |
| Bidirectional BFS for shortest unweighted path. | |
| file | Blossom_Weighted.H |
| Maximum-weight matching in general undirected graphs. | |
| file | Bounded_Cycle_Index.H |
| Index of the simple cycles of bounded length of a digraph, with a weight for each arc and a filter by the weight of a cycle. | |
| file | cookie_guard.H |
| RAII guards for graph node/arc cookies. | |
| file | Dial.H |
| Dial's algorithm for shortest paths with small integer weights. | |
| file | Dijkstra.H |
| Dijkstra's shortest path algorithm. | |
| file | Dominators.H |
| Dominator and post-dominator tree computation via the Lengauer-Tarjan algorithm. | |
| file | euclidian-graph-common.H |
| Common utilities for Euclidean graphs. | |
| file | eulerian.H |
| Eulerian graph detection and path/cycle finding. | |
| file | Floyd_Warshall.H |
| Floyd-Warshall algorithm for all-pairs shortest paths. | |
| file | generate_df_tree.H |
| Pictures of depth-first trees with their df and low numbers. | |
| file | generate_graph.H |
| Graph visualization and output generation utilities. | |
| file | generate_spanning_tree_picture.H |
| Spanning tree visualization with highlighted tree/non-tree edges. | |
| file | graph-dry.H |
| Graph base classes and common utilities via CRTP. | |
| file | graph-traverse-generators.H |
| Lazy (coroutine-based) graph traversal (DFS, BFS). | |
| file | graph-traverse.H |
| Graph traversal algorithms (DFS, BFS). | |
| file | Graph_Coloring.H |
| Graph coloring algorithms and heuristics. | |
| file | graph_to_tree.H |
| Convert spanning tree graphs to Tree_Node structures. | |
| file | grid.H |
| 2D grid graph generation with 8-connectivity. | |
| file | hamiltonian.H |
| Hamiltonian sufficiency testing for graphs. | |
| file | HLD.H |
| Heavy-Light Decomposition for tree path queries on Aleph graphs. | |
| file | Howard_Min_Mean_Cycle.H |
| Minimum mean cycle by Howard's policy iteration. | |
| file | IDA_Star.H |
| IDA* (Iterative Deepening A*) shortest path algorithm. | |
| file | io_graph.H |
| Graph serialization and deserialization utilities. | |
| file | Johnson.H |
| Johnson's algorithm for all-pairs shortest paths. | |
| file | K_Shortest_Paths.H |
| K-shortest path algorithms (Yen and Eppstein-style API). | |
| file | Karger.H |
| Karger's randomized min-cut algorithm. | |
| file | Karger_Stein.H |
| Karger-Stein randomized min-cut algorithm (alias for Karger.H fast method). | |
| file | kosaraju.H |
| Kosaraju's algorithm for finding strongly connected components. | |
| file | Kruskal.H |
| Kruskal's minimum spanning tree algorithm. | |
| file | latex_floyd.H |
| Floyd-Warshall algorithm with LaTeX output generation. | |
| file | LCA.H |
| Lowest Common Ancestor (LCA) on rooted trees represented as Aleph graphs. | |
| file | load_digraph.H |
| Utilities for loading directed graphs from pipe-separated files. | |
| file | mat_path.H |
| Path reconstruction from Floyd-Warshall path matrices. | |
| file | Min_Cost_Matching.H |
| Minimum-cost matching in general undirected graphs. | |
| file | Min_Mean_Cycle.H |
| Minimum mean cycle in directed graphs (Karp algorithm). | |
| file | Negative_Cycles.H |
| Enumeration of negative cycles and bounded-length most negative cycle in directed graphs. | |
| file | net_apps.H |
| Network flow applications. | |
| file | net_utils.H |
| Network flow utilities: generators, visualization, serialization. | |
| file | Planarity_Test.H |
| Planarity testing on Aleph graphs. | |
| file | Prim.H |
| Prim's algorithm for minimum spanning trees. | |
| file | random_graph.H |
| Random graph generation utilities. | |
| file | random_net.H |
| Random network flow graph generation. | |
| file | shortest_path_common.H |
| Common utilities and base class for shortest path algorithms. | |
| file | single_graph.H |
| Single graph utilities. | |
| file | Stoer_Wagner.H |
| Stoer-Wagner deterministic min-cut algorithm. | |
| file | Tarjan.H |
| Tarjan's algorithm for strongly connected components. | |
| file | topological_sort.H |
| Topological sorting algorithms for directed acyclic graphs (DAGs). | |
| file | tpl_agraph.H |
| Array-based graph implementation. | |
| file | tpl_bipartite.H |
| Bipartite graph detection and 2-coloring. | |
| file | tpl_components.H |
| Graph connectivity and connected components. | |
| file | tpl_const_graph_view.H |
Strict read-only access to a graph: Const_Graph_View and the read-only iterators on the nodes, on the arcs and on the arcs of a node. | |
| file | tpl_cut_nodes.H |
| Articulation points (cut nodes), bridges, and biconnected components. | |
| file | tpl_dfs_stack.H |
| Stack of the frames of a depth-first search that does not recurse. | |
| file | tpl_euclidian_graph.H |
| Euclidean graph with 2D coordinates. | |
| file | tpl_find_path.H |
| Path finding algorithms in graphs. | |
| file | tpl_graph.H |
| Generic graph and digraph implementations. | |
| file | tpl_graph_indexes.H |
| Graph node and arc indexing. | |
| file | tpl_graph_utils.H |
| Utility algorithms and operations for graphs. | |
| file | tpl_indexArc.H |
| Arc indexing for fast lookup by endpoint nodes. | |
| file | tpl_indexGraph.H |
| Graph indexing utilities for O(log n) node/arc lookup. | |
| file | tpl_indexNode.H |
| Node indexing for fast O(log n) lookup by key. | |
| file | tpl_kgraph.H |
| K-connected graph structures and connectivity algorithms. | |
| file | tpl_matgraph.H |
| Adjacency matrix representations for graphs. | |
| file | tpl_maxflow.H |
| Advanced maximum flow algorithms. | |
| file | tpl_mincost.H |
| Advanced minimum cost flow algorithms. | |
| file | tpl_mo_on_trees.H |
| Mo's algorithm on trees: offline subtree and path queries. | |
| file | tpl_net.H |
| Network flow graph structures. | |
| file | tpl_net_sup_dem.H |
| Supply-demand network flow algorithms. | |
| file | tpl_netcapgraph.H |
| Network flow graph with capacities. | |
| file | tpl_sgraph.H |
| Simple graph implementation with adjacency lists. | |
| file | tpl_spanning_tree.H |
| Spanning tree generation algorithms. | |
| file | tpl_test_acyclique.H |
| DAG (acyclic) graph testing. | |
| file | tpl_test_connectivity.H |
| Graph connectivity testing. | |
| file | tpl_test_cycle.H |
| Cycle detection in graphs. | |
| file | tpl_test_path.H |
| Path existence testing. | |
| file | Tree_Decomposition.H |
| Heavy-Light and Centroid decomposition on rooted trees represented as Aleph graphs. | |
| file | Two_Sat.H |
| 2-SAT solver based on Tarjan's SCC algorithm. | |
| file | warshall.H |
| Warshall's algorithm for transitive closure. | |
| file | xml_graph.H |
| XML serialization for graphs. | |
| file | Zero_One_BFS.H |
| 0-1 BFS shortest path algorithm. | |
Concepts | |
| concept | Aleph::MoTreeGraph |
| Concept constraining a graph type usable for Mo on Trees. | |
Classes | |
| class | Aleph::Bit_Fields |
| Bit fields for nodes and arcs used for marking visit state during processing. More... | |
| struct | Aleph::Graph_Attr |
| General attributes for nodes and arc of graphs. More... | |
| struct | Aleph::Zero_Heuristic< GT, Distance > |
| Default heuristic for A* (zero heuristic, degrades to Dijkstra). More... | |
| class | Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT > |
| A* algorithm for finding the shortest path between two nodes. More... | |
| struct | Aleph::Euclidean_Heuristic< GT, Distance > |
| Euclidean distance heuristic for A* in 2D grids. More... | |
| struct | Aleph::Manhattan_Heuristic< GT, Distance > |
| Manhattan distance heuristic for A* in grid graphs. More... | |
| class | Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA > |
| Bellman-Ford algorithm for shortest paths with negative weights. More... | |
| struct | Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::Sni |
| struct | Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::Ni |
| struct | Aleph::Bellman_Ford_Negative_Cycle< GT, Distance, Ait, NAit, SA > |
| Detects if a negative cycle exists and eventually computes it. More... | |
| class | Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA > |
| Bidirectional BFS for finding shortest unweighted paths. More... | |
| struct | Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::BFS_Info |
| class | Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::BiBFS_Init_Guard |
| RAII guard for BiBFS initialization and cleanup. More... | |
| class | Aleph::Compute_Maximum_Cardinality_General_Matching< GT, SA > |
| Functor wrapper for maximum cardinality general matching. More... | |
| struct | Aleph::Blossom_Weighted_Result< Weight_Type > |
| Result of weighted matching. More... | |
| class | Aleph::Compute_Maximum_Weight_General_Matching< GT, Weight, SA > |
| Functor wrapper for weighted blossom matching. More... | |
| class | Aleph::Bounded_Cycle_Index< GT > |
| Index of the simple cycles of bounded length of a digraph. More... | |
| struct | Aleph::Bounded_Cycle_Index< GT >::Number_Table |
| struct | Aleph::Bounded_Cycle_Index< GT >::Shape |
| struct | Aleph::Bounded_Cycle_Index< GT >::Path |
| struct | Aleph::Bounded_Cycle_Index< GT >::Marks |
| class | Aleph::Cookie_Guard< GT > |
| RAII guard that clears graph cookies on destruction. More... | |
| class | Aleph::Cookie_Saver< GT > |
| RAII guard that saves and restores graph cookies. More... | |
| class | Aleph::Scope_Guard< GT, Cleanup > |
| Generic RAII scope guard for cleanup operations on graphs. More... | |
| class | Aleph::Dial_Min_Paths< GT, Distance, Itor, SA > |
| Dial's algorithm for shortest paths with integer weights. More... | |
| struct | Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::Node_Info |
| class | Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::Dial_Init_Guard |
| RAII guard for Dial initialization and cleanup. More... | |
| class | Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT > |
| Spanning tree calculation of all shortest paths from a given node according to Dijkstra's algorithm. More... | |
| class | Aleph::Test_Eulerian< GT, SN, SA > |
| Tests whether a graph or digraph is Eulerian. More... | |
| class | Aleph::Find_Eulerian_Path< GT, SN, SA > |
| Finds and constructs an Eulerian path or cycle using Hierholzer's algorithm. More... | |
| struct | Aleph::Find_Eulerian_Path< GT, SN, SA >::Result |
| Result type: path and its classification. More... | |
| class | Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA > |
Compute the all-pairs shortest path distance matrix and the path reconstruction matrix for a graph g using the Floyd-Warshall algorithm. More... | |
| struct | Aleph::Df_Low_Key |
| Key of a node of a depth-first tree with df and low numbers. More... | |
| struct | Aleph::Dft_Df_Tree_Label< GT > |
Default label of a graph node: its information, written with operator <<. More... | |
| struct | Aleph::Write_Df_Tree_Label |
| Writer for generate_tree() that shows the label of each node. More... | |
| struct | Aleph::Write_Df_Tree_Df |
Writer for generate_tree() that shows the label and the df number of each node, as (label,df). More... | |
| struct | Aleph::Write_Df_Tree_Low |
Writer for generate_tree() that shows the label, the df and the low numbers of each node, as label,df,low. More... | |
| struct | Aleph::To_Graphviz< GT, Node_Attr, Arc_Attr, SN, SA > |
| Functor class for generating Graphviz DOT specifications. More... | |
| struct | Aleph::Generate_Graphviz< GT, Write_Node, Write_Arc, Shade_Node, Shade_Arc, Dashed_Node, Dashed_Arc, SA, SN > |
| Functor for generating Graphviz specifications. More... | |
| struct | GTNodeIterator< GT > |
| Common node iterator for graph having its node derived from Dlink class. More... | |
| struct | GTArcIterator< GT > |
| Common arc iterator for graph having its arcs derived from Dlink class. More... | |
| struct | Cmp_Dlink_Node< GT, Cmp > |
| Used internally for some graphs for compare their nodes. More... | |
| struct | Cmp_Dlink_Arc< GT, Cmp > |
| Used internally for some graphs for compare their arcs. More... | |
| class | GTNodeCommon< NodeInfo > |
| Common attributes and methods for nodes (vertexes) belonging to graphs. More... | |
| class | GTArcCommon< ArcInfo > |
| Common methods for the arc of a graph. More... | |
| class | GraphCommon< GT, Node, Arc > |
Common methods to the Aleph-w ( \(\aleph_\omega\)) graph classes. More... | |
| struct | GraphCommon< GT, Node, Arc >::In_Filt |
| Filter for input arcs of a node. More... | |
| struct | GraphCommon< GT, Node, Arc >::Out_Filt |
| Filter for output arcs of a node. More... | |
| class | GraphCommon< GT, Node, Arc >::Digraph_Iterator< Filter > |
| Special iterator for distinguishing input arcs of output ones. More... | |
| struct | GraphCommon< GT, Node, Arc >::In_Iterator |
Alias for Digraph_Iterator More... | |
| struct | GraphCommon< GT, Node, Arc >::Out_Iterator |
| class | Aleph::Digraph< BaseGraph > |
| Generic directed graph (digraph) wrapper template. More... | |
| struct | Aleph::Digraph< BaseGraph >::In_Iterator |
| Iterator on the arcs that go into a node of the digraph. More... | |
| class | Aleph::Graph_Traverse_Generator< GT, Itor, Q, Show_Arc > |
| Lazily traverse a graph depth-first or breadth-first. More... | |
| class | Graph_Traverse< GT, Itor, Q, Show_Arc > |
| Traverse a graph depth-first or breadth-first and execute a visit function. More... | |
| class | Aleph::Greedy_Coloring< GT, SA > |
| Functor wrapper for greedy_coloring. More... | |
| class | Aleph::Welsh_Powell_Coloring< GT, SA > |
| Functor wrapper for welsh_powell_coloring. More... | |
| class | Aleph::DSatur_Coloring< GT, SA > |
| Functor wrapper for dsatur_coloring. More... | |
| class | Aleph::Graph_To_Tree_Node< GT, Key, Convert, SA > |
| Functor class to convert a tree graph to Tree_Node structure. More... | |
| class | Aleph::Build_Grid< GT, Operation_On_Node, Operation_On_Arc > |
| Functor to build a 2D grid graph with 8-connectivity. More... | |
| class | Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA > |
| Tests Ore's sufficient condition for Hamiltonian graphs. More... | |
| class | Aleph::Test_Dirac_Condition< GT, SN, SA > |
| Tests Dirac's sufficient condition for Hamiltonian graphs. More... | |
| class | Aleph::Gen_HLD< GT, T, Op, SA > |
| Heavy-Light Decomposition with segment tree for path/subtree queries. More... | |
| struct | Aleph::HLD_Sum< GT, T, SA > |
| HLD with path/subtree sum queries. More... | |
| struct | Aleph::HLD_Max< GT, T, SA > |
| HLD with path/subtree max queries. More... | |
| struct | Aleph::HLD_Min< GT, T, SA > |
| HLD with path/subtree min queries. More... | |
| struct | Aleph::Howard_Mean_Cycle_Result< GT, Cost_Type > |
Result of howard_minimum_mean_cycle(). More... | |
| struct | Aleph::Hungarian_Result< Cost_Type > |
| Result of the Hungarian assignment algorithm. More... | |
| struct | Aleph::Chebyshev_Heuristic< GT, Distance > |
| Chebyshev (L-infinity) distance heuristic for 8-connected grids. More... | |
| class | Aleph::IDA_Star< GT, Distance, Heuristic, Itor, SA > |
| IDA* algorithm for memory-efficient shortest path search. More... | |
| struct | Aleph::IDA_Star< GT, Distance, Heuristic, Itor, SA >::SearchResult |
| struct | Aleph::Dft_Store_Node< GT > |
| Default node storage functor for binary and text modes. More... | |
| struct | Aleph::Dft_Store_Arc< GT > |
| Default arc storage functor for binary and text modes. More... | |
| struct | Aleph::Dft_Load_Node< GT > |
| Default node loading functor for binary and text modes. More... | |
| struct | Aleph::Dft_Load_Arc< GT > |
| Default arc loading functor for binary and text modes. More... | |
| class | Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF > |
| Graph serialization and deserialization class. More... | |
| class | Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::Loaded_Nodes |
| The nodes that a load has read, by their index in the stream. More... | |
| class | Aleph::Johnson< GT, Distance, Ait, NAit, SA > |
| Johnson's algorithm for all-pairs shortest paths. More... | |
| struct | Aleph::Johnson< GT, Distance, Ait, NAit, SA >::Shown_Arc |
| struct | Aleph::Johnson< GT, Distance, Ait, NAit, SA >::Kept_Source |
| struct | Aleph::K_Shortest_Path_Item< GT, Cost_Type > |
| A shortest-path item returned by k-shortest algorithms. More... | |
| class | Aleph::Yen_K_Shortest_Paths< GT, Distance, SA > |
| Functor wrapper for Yen's k-shortest loopless paths algorithm. More... | |
| class | Aleph::Eppstein_K_Shortest_Paths< GT, Distance, SA > |
| Functor wrapper for Eppstein-style k-shortest paths API. More... | |
| class | Aleph::Karger_Min_Cut< GT, SA > |
| Karger's randomized minimum cut algorithm. More... | |
| class | Aleph::Karger_Min_Cut< GT, SA >::ArcIndex |
| Arc index with O(1) operations and deterministic ordering. More... | |
| struct | Aleph::Kosaraju_Connected_Components< GT > |
| Functor wrapper for Kosaraju's algorithm. More... | |
| class | Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA > |
| Computes the minimum spanning tree of a graph using Kruskal's algorithm. More... | |
| struct | Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::Init_Node |
| Helper struct for initializing node counters during DFS. More... | |
| struct | Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::Paint_Filt< G, GT_SA > |
| Filter for arcs painted by Kruskal's algorithm. More... | |
| class | Aleph::Gen_Binary_Lifting_LCA< GT, SA > |
| LCA via binary lifting on a rooted tree. More... | |
| class | Aleph::Gen_Euler_RMQ_LCA< GT, SA > |
| LCA via Euler tour + RMQ on depth in a rooted tree. More... | |
| struct | Aleph::Equal_Node |
| Functor to compare nodes by their ID. More... | |
| class | Aleph::Find_Min_Path< Mat, Compare > |
| Functor wrapper for find_min_path. More... | |
| struct | Aleph::Min_Cost_Matching_Result< Cost_Type > |
| Result of minimum-cost matching. More... | |
| struct | Aleph::Min_Cost_Perfect_Matching_Result< Cost_Type > |
| Result of minimum-cost perfect matching. More... | |
| class | Aleph::Compute_Minimum_Cost_General_Matching< GT, Cost, SA > |
| Functor wrapper for minimum-cost general matching. More... | |
| class | Aleph::Compute_Minimum_Cost_Perfect_General_Matching< GT, Cost, SA > |
| Functor wrapper for minimum-cost perfect general matching. More... | |
| struct | Aleph::Min_Mean_Cycle_Result< GT, Cost_Type > |
| Result of minimum mean cycle computation. More... | |
| struct | Aleph::Min_Mean_Cycle_Value_Result |
| Lightweight minimum-mean-cycle value result. More... | |
| class | Aleph::Karp_Minimum_Mean_Cycle< GT, Distance, SA > |
| Functor wrapper for Karp minimum mean cycle. More... | |
| class | Aleph::Karp_Minimum_Mean_Cycle_Value< GT, Distance, SA > |
| Functor wrapper for value-only minimum mean cycle. More... | |
| struct | Aleph::Negative_Cycle_Item< GT, Cost_Type > |
One negative cycle reported by find_disjoint_negative_cycles(). More... | |
| struct | Aleph::Bounded_Cycle_Result< GT, Cost_Type > |
Result of most_negative_cycle_bounded(). More... | |
| struct | Aleph::Short_Cycle_Result< GT, Cost_Type > |
| Exact optimum returned by most_negative_cycle_up_to_3(). More... | |
| struct | Aleph::Planarity_Test_Options |
| Configuration options for planarity testing and auxiliary outputs. More... | |
| struct | Aleph::Planarity_Test_Result< GT > |
| Complete result of a planarity test execution. More... | |
| struct | Aleph::Planarity_Test_Result< GT >::Rotation_Entry |
| Entry in a combinatorial rotation system. More... | |
| struct | Aleph::Planarity_Test_Result< GT >::Edge_Witness |
| Description of an edge participating in a witness. More... | |
| struct | Aleph::Planarity_Test_Result< GT >::Path_Witness |
| Description of a path participating in a Kuratowski witness. More... | |
| struct | Aleph::Planar_Dual_Edge_Info< GT > |
| Dual-edge payload linked to a primal simplified edge. More... | |
| struct | Aleph::Planar_Dual_Metadata< GT > |
| Metadata extracted from a planar embedding for face/dual analysis. More... | |
| struct | Aleph::Planar_Dual_Metadata< GT >::Face_Dart |
| struct | Aleph::Planar_Dual_Metadata< GT >::Face_Boundary |
| struct | Aleph::Planar_Geometric_Drawing_Options |
| Options for embedding-aware 2D drawing extraction. More... | |
| struct | Aleph::Planar_Geometric_Drawing< GT > |
| Embedding-aware geometric drawing result. More... | |
| struct | Aleph::Planar_Geometric_Drawing< GT >::Node_Position |
| struct | Aleph::NonPlanar_Certificate_Export_Options |
| Export options for non-planar certificate serializers. More... | |
| struct | Aleph::NonPlanar_Certificate_Validation< GT > |
| Structural validation report for non-planar certificates. More... | |
| struct | Aleph::Dft_Certificate_Node_Label< GT > |
| Default node labeler for certificate export. More... | |
| class | Aleph::Planarity_Test< GT, SA > |
Functor wrapper for planarity_test(). More... | |
| class | Aleph::Is_Planar_Graph< GT, SA > |
Functor wrapper for is_planar_graph(). More... | |
| class | Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA > |
| Computes the minimum spanning tree of a graph using Prim's algorithm. More... | |
| struct | Aleph::Dft_Init_Rand_Node< GT > |
| Default node initializer for random graph generation. More... | |
| struct | Aleph::Dft_Init_Rand_Arc< GT > |
| Default arc initializer for random graph generation. More... | |
| class | Aleph::Kept_Initializer< F > |
| An initializer that a random generator keeps: one given as a modifiable lvalue is used where it is, so that the caller sees what the generator does to it; a temporary, or a const lvalue, is moved or copied into the generator, so that it lives as long as the generator. More... | |
| class | Aleph::Random_Graph< GT, Init_Node, Init_Arc > |
| Random undirected graph generator. More... | |
| class | Aleph::Random_Digraph< GT, Init_Node, Init_Arc > |
| Random directed graph (digraph) generator. More... | |
| class | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT > |
| Base class providing common infrastructure for shortest path algorithms. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Arc_Info |
| Information stored in arc cookies for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Tree_Arc_Info |
| Extended arc info with tree arc mapping. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Node_Info |
| Information stored in node cookies for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Tree_Node_Info |
| Extended node info with tree node mapping. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Heap_Info |
| Functor to access heap node handle from node cookie. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Get_Potential_Arc |
| Functor to get arc potential for heap ordering. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Node |
| Node initialization for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Arc |
| Arc initialization for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Tree_Node |
| Node initialization for tree-building version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Initialize_Tree_Arc |
| Arc initialization for tree-building version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Node |
| Node cleanup for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Arc |
| Arc cleanup for painting version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Tree_Node |
| Node cleanup and mapping for tree-building version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Destroy_Tree_Arc |
| Arc cleanup and mapping for tree-building version. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Total |
| Distance totalizer class for path copying. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Painted_Arc |
| Arc filter that shows the arcs of the painted tree. More... | |
| struct | Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::Painted_Node |
| Node filter that shows the nodes of the painted tree. More... | |
| class | Aleph::Test_Single_Graph< GT, SN, SA > |
| Determines whether a graph or digraph is simple. More... | |
| class | Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA > |
| Stoer-Wagner deterministic minimum cut algorithm. More... | |
| struct | Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::SWNode |
| struct | Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::PQEntry |
| class | Aleph::Compute_Cycle_In_Digraph< GT, Itor, SA > |
| Determines if a digraph contains a cycle and constructs it. More... | |
| class | Aleph::Topological_Sort< GT, Itor, SA > |
| Computes topological ordering using depth-first search. More... | |
| struct | Aleph::Topological_Sort< GT, Itor, SA >::Frame |
| class | Aleph::Q_Topological_Sort< GT, Itor, SA > |
| Computes topological ordering using breadth-first search (Kahn's algorithm). More... | |
| class | Aleph::Graph_Anode< Node_Info > |
Node of Array_Graph More... | |
| class | Aleph::Compute_Bipartite< GT, SA > |
| Class that takes a bipartite graph and computes the partition sets. More... | |
| class | Aleph::Compute_Maximum_Cardinality_Bipartite_Matching< GT, Max_Flow, SA > |
| Class for computing the maximum cardinality matching of a bipartite graph. More... | |
| class | Aleph::Hopcroft_Karp_Matching< GT, SA > |
| Functor wrapper for hopcroft_karp_matching. More... | |
| class | Aleph::Build_Subgraph< GT, SA > |
| Build a mapped subgraph from a graph starting at a given node. More... | |
| struct | Aleph::Build_Subgraph< GT, SA >::Map_Frame |
| struct | Aleph::Build_Subgraph< GT, SA >::Arc_Frame |
| class | Aleph::Unconnected_Components< GT, SA > |
| Compute the connected components of a graph. More... | |
| class | Aleph::Const_Node_Iterator< GT > |
| Read-only iterator on the nodes of a graph. More... | |
| class | Aleph::Const_Arc_Iterator< GT > |
| Read-only iterator on the arcs of a graph. More... | |
| class | Aleph::Const_Node_Arc_Iterator< GT > |
| Read-only iterator on the arcs of a node. More... | |
| class | Aleph::Const_Graph_View< GT > |
| Strict read-only view of a graph. More... | |
| class | Aleph::Compute_Bridges< GT, SA > |
| Find bridge edges (isthmuses) of a connected undirected graph. More... | |
| struct | Aleph::Compute_Bridges< GT, SA >::Frame |
| class | Aleph::Dfs_Stack< T > |
| Stack of the frames of a depth-first search that does not recurse. More... | |
| struct | Aleph::Dfs_Arc_Frame< It > |
| The next arc of a node to look at, for a depth-first search that keeps only that in a frame. More... | |
| class | Aleph::Euclidian_Node< Node_Info > |
| class | Aleph::Find_Path_Depth_First< GT, Itor, SA > |
| Performs a depth-first search for a path between a pair of nodes. More... | |
| struct | Aleph::Find_Path_Depth_First< GT, Itor, SA >::Frame |
| class | Aleph::Find_Path_Breadth_First< GT, Itor, SA > |
| Performs a breadth-first search for a path between a pair of nodes. More... | |
| class | Aleph::Directed_Find_Path< GT, Itor, SA > |
| Path search on directed graphs defined through a graph class (not a digraph). More... | |
| struct | Aleph::Graph_Node< __Node_Info > |
| Node belonging to a graph implemented with a double linked adjacency list. More... | |
| struct | Aleph::Graph_Arc< _Arc_Info > |
| Arc of graph implemented with double-linked adjacency lists. More... | |
| class | Aleph::List_Graph< _Graph_Node, _Graph_Arc > |
| Graph implemented with double-linked adjacency lists. More... | |
| struct | Aleph::List_Graph< _Graph_Node, _Graph_Arc >::Node_Iterator |
| Node iterator. More... | |
| class | Aleph::List_Graph< _Graph_Node, _Graph_Arc >::Node_Arc_Iterator |
| Iterator on the arcs of a graph. More... | |
| struct | Aleph::List_Graph< _Graph_Node, _Graph_Arc >::Arc_Iterator |
| Iterator on all arcs of a graph. More... | |
| struct | Aleph::Dft_Show_Arc< GT > |
| Default filter for filtered iterators on arcs. More... | |
| struct | Aleph::Node_Arc_Iterator< GT, Show_Arc > |
| Filtered iterator of adjacent arcs of a node. More... | |
| struct | Aleph::Arc_Iterator< GT, Show_Arc > |
| Filtered iterator on all the arcs of a graph. More... | |
| struct | Aleph::Dft_Show_Node< GT > |
| Default filter for the graph nodes. More... | |
| class | Aleph::Kept_Filter< F > |
| A filter that an algorithm object keeps: one given as an lvalue is used where it is, so that the caller sees what the algorithm does to it; one given as an rvalue is moved into the keeper, so that it lives as long as the object. More... | |
| class | Aleph::Node_Iterator< GT, Show_Node > |
| Filtered iterator on the nodes of a graph. More... | |
| class | Aleph::__Out_Filt< GT > |
| Filter the outcoming arcs. More... | |
| class | Aleph::__In_Filt< GT > |
| Filter the incoming arcs. More... | |
| class | Aleph::Digraph_Iterator< GT, Filter > |
| Filtered iterator on directed graphs. More... | |
| class | Aleph::Out_Iterator< GT, Show_Arc > |
| Filtered iterator for outcoming arcs of a node. More... | |
| class | Aleph::In_Iterator< GT, SA > |
| Filtered iterator for incoming arcs of a node. More... | |
| class | Aleph::In_Iterator< GT, SA > |
| Filtered iterator for incoming arcs of a node of a digraph type. More... | |
| class | Aleph::In_Arcs_Index< GT, SA > |
| Index of the arcs that go into each node of a graph. More... | |
| class | Aleph::In_Arcs_Index< GT, SA >::Iterator |
| Iterator on the arcs into a node, in the order of the arc iterator of the graph when the index was built. More... | |
| class | Aleph::Operate_On_Nodes< GT, Operation, SN > |
| Functor that traverses the nodes of a graph and performs an operation. More... | |
| class | Aleph::Operate_On_Arcs< GT, Operation, SA > |
| Functor that traverses the arcs of a graph and performs an operation. More... | |
| class | Aleph::Path< GT > |
| Path on a graph. More... | |
| struct | Aleph::Path< GT >::Path_Desc |
| class | Aleph::Path< GT >::Iterator |
| Iterator on nodes and arcs of a path. More... | |
| struct | Aleph::Dft_Copy_Node< GTT, GTS > |
| Default copy node functor. More... | |
| struct | Aleph::Dft_Copy_Arc< GTT, GTS > |
| Default copy arc functor. More... | |
| class | Aleph::Copy_Graph< GT, SN, SA > |
| Filtered copy of graphs. More... | |
| struct | Aleph::Painted_Min_Spanning_Tree< GT, Distance > |
| Filter of painter arcs with that are set the Spanning_Tree control bit. More... | |
| class | Aleph::GraphCopyWithMapping< GT, Tree > |
| Graph copy with explicit node mapping. More... | |
| class | Aleph::Nodes_Index< GT, Compare, Tree, SN > |
| Builds a node index for fast lookup and retrieval. More... | |
| class | Aleph::Arcs_Index< GT, Compare, Tree, SA > |
| Builds an arc index for fast lookup by source/target nodes. More... | |
| struct | Aleph::Default_Visit_Op< GT > |
| Default visit operation for traversals (never stops). More... | |
| class | Aleph::Depth_First_Traversal< GT, Operation, SA > |
| Stateful depth-first traversal functor. More... | |
| class | Aleph::Breadth_First_Traversal< GT, Operation, SA > |
| Stateful breadth-first traversal functor. More... | |
| struct | Aleph::Distance_Compare< GT, Distance > |
| Comparison functor for arc weights/distances. More... | |
| class | Aleph::Invert_Digraph< GT, SA > |
| Functor for computing the transposed digraph, filtering arcs. More... | |
| class | Aleph::Dft_Dist< GT > |
| Default distance accessor for arc weights. More... | |
| class | Aleph::Total_Cost< GT, Distance, SA > |
| Compute the total cost (sum of arc weights) of a graph. More... | |
| class | Aleph::IndexArc< GT, Tree, SA > |
| Index for fast arc lookup by its endpoint nodes. More... | |
| struct | Aleph::IndexArc< GT, Tree, SA >::Cmp_Arc |
| class | Aleph::Index_Graph< GT, Compare, Tree > |
| Builds node and arc indices for fast lookup and retrieval. More... | |
| class | Aleph::Edge_Connectivity< GT, Max_Flow > |
| Functor wrapper for edge_connectivity(). More... | |
| class | Aleph::Compute_Min_Cut< GT, Max_Flow, SA > |
| Functor wrapper for compute_min_cut(). More... | |
| class | Aleph::Map_Matrix_Graph< GT, SA > |
| Adjacency matrix mapped to an adjacency list graph. More... | |
| struct | Aleph::Map_Matrix_Graph< GT, SA >::Mat_Entry |
| class | Aleph::Matrix_Graph< GT, SA > |
| Adjacency matrix storing copies of graph attributes. More... | |
| class | Aleph::Ady_Mat< GT, __Entry_Type, SA > |
| Auxiliary adjacency matrix with custom entry type. More... | |
| class | Aleph::Bit_Mat_Graph< GT, SA > |
| Bit matrix for graph connectivity. More... | |
| struct | Aleph::Bit_Mat_Graph< GT, SA >::Proxy |
| Proxy for bit access. More... | |
| class | Aleph::Gen_Mo_On_Trees< GT, Policy > |
| Offline subtree and path queries on trees via Mo's algorithm. More... | |
| class | Aleph::Net_Sup_Dem_Node< Node_Info, F_Type > |
| Node with supply/demand flow value. More... | |
| class | Aleph::Net_Sup_Dem_Graph< NodeT, ArcT > |
| Network graph with supply and demand nodes. More... | |
| struct | Aleph::Graph_Snode< Node_Info > |
| Node for graphs implemented with simple adjacency lists. More... | |
| class | Aleph::Graph_Sarc< Arc_Info > |
| Arc for graphs implemented with simple adjacency lists. More... | |
| class | Aleph::List_SGraph< __Graph_Node, __Graph_Arc > |
| Graph class implemented with singly-linked adjacency lists. More... | |
| class | Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Node_Iterator |
| Node iterator for a graph. More... | |
| class | Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator |
| Arc iterator for a graph node. More... | |
| class | Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Arc_Iterator |
| Iterator over arcs of a graph. More... | |
| class | Aleph::Find_Depth_First_Spanning_Tree< GT, SA > |
| Compute a depth-first spanning tree of a graph. More... | |
| struct | Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::Frame |
| class | Aleph::Find_Breadth_First_Spanning_Tree< GT, SA > |
| Compute a breadth-first spanning tree of a graph. More... | |
| class | Aleph::Build_Spanning_Tree< GT > |
| Build a spanning tree from an array of arcs. More... | |
| class | Aleph::Is_Graph_Acyclique< GT, SA > |
| Determines whether a graph is acyclic (contains no cycles). More... | |
| class | Aleph::Has_Cycle< GT, SA > |
| Determines whether a graph contains cycles. More... | |
| class | Test_Connectivity< GT, SA > |
| Determines if a graph g is connected. More... | |
| class | Aleph::Test_For_Cycle< GT, SA > |
| Test whether a cycle is reachable from a given node. More... | |
| class | Aleph::Test_For_Path< GT, SA > |
| Checks whether a path exists between two nodes. More... | |
| class | Fixed_Relation |
| Binary relation between a set of integers. More... | |
| class | Relation |
| Binary relation between a set of integers. More... | |
| class | Relation_T< T, Compare > |
| Binary relation between a set of items. More... | |
| struct | Relation_T< T, Compare >::Pair |
| struct | Relation_T< T, Compare >::Cmp |
| class | Aleph::Gen_Heavy_Light_Decomposition< GT, SA > |
| Heavy-Light Decomposition over a rooted tree represented as an Aleph graph. More... | |
| class | Aleph::Gen_HLD_Path_Query< GT, T, Op, SA > |
| Segment-tree-powered path/subtree queries over an HLD layout. More... | |
| class | Aleph::Gen_Centroid_Decomposition< GT, SA > |
| Centroid decomposition over a rooted tree represented as an Aleph graph. More... | |
| class | Aleph::Warshall_Compute_Transitive_Clausure< GT, SA > |
| Computes the transitive closure of a graph using Warshall's algorithm. More... | |
| class | Aleph::Zero_One_BFS< GT, Distance, Itor, SA > |
| 0-1 BFS algorithm for shortest paths in graphs with 0/1 weights. More... | |
| struct | Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::Node_Info |
| class | Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::ZOB_Init_Guard |
| RAII guard for Zero_One_BFS initialization and cleanup. More... | |
| class | Aleph::Lengauer_Tarjan_Dominators< GT, SA > |
| Computes dominator tree and dominance frontiers of a digraph using the Lengauer-Tarjan algorithm. More... | |
| class | Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA > |
| Computes post-dominator tree and post-dominance frontiers of a digraph using the Lengauer-Tarjan algorithm on the reversed graph. More... | |
| class | Aleph::Tarjan_Connected_Components< GT, Itor, SA > |
| Computes strongly connected components (SCCs) in a directed graph using Tarjan's algorithm. More... | |
| class | Aleph::IndexNode< GT, Compare, Tree, SN > |
| Builds an index of nodes for fast search and retrieval. More... | |
Macros | |
| #define | NODE_BITS(p) ((p)->attrs.control_bits) |
| Get the control bits of a node. | |
| #define | NODE_COUNTER(p) ((p)->attrs.counter) |
| Get the counter of a node. | |
| #define | NODE_COLOR(p) ((p)->attrs.counter) |
| Synonymous of NODE_COUNTER. | |
| #define | IS_NODE_VISITED(p, bit) (NODE_BITS(p).get_bit(bit)) |
| Determine whether the control bit is set or not to one. | |
| #define | NODE_COOKIE(p) ((p)->attrs.cookie) |
Return the node cookie | |
| #define | ARC_COUNTER(p) ((p)->attrs.counter) |
Return the counter of arc p. | |
| #define | ARC_COLOR(p) ((p)->attrs.counter) |
| Return the color of arc p. | |
| #define | ARC_BITS(p) ((p)->attrs.control_bits) |
| Return the control bits of arc p. | |
| #define | IS_ARC_VISITED(p, bit) (ARC_BITS(p).get_bit(bit)) |
Determine whether the bit field is or not set to one. | |
| #define | ARC_COOKIE(p) ((p)->attrs.cookie) |
Return the arc cookie | |
| #define | ALEPH_GRAPH_COPY_MOVE_CTORS(GraphClass) |
| Macro to generate copy/move constructors and assignment operators. | |
| #define | ALEPH_FLATTEN [[gnu::flatten]] |
[[gnu::flatten]], or nothing where it would only make the compilation slower. | |
Typedefs | |
| template<typename __Graph_Node = Graph_Anode<int>, typename __Graph_Arc = Graph_Aarc<int>> | |
| using | Aleph::Array_Digraph = Digraph< Array_Graph< __Graph_Node, __Graph_Arc > > |
| Directed graph (digraph) implemented with array-based adjacency lists. | |
| template<class T > | |
| using | Aleph::Dfs_Here = std::conditional_t< std::is_move_assignable_v< T >, T, std::optional< T > > |
| The variable that holds the frame of the node that a depth-first search visits. | |
| template<typename __Graph_Node = Graph_Node<int>, typename __Graph_Arc = Graph_Arc<int>> | |
| using | Aleph::List_Digraph = Digraph< List_Graph< __Graph_Node, __Graph_Arc > > |
| Directed graph (digraph) implemented with double-linked adjacency lists. | |
| template<class GT > | |
| using | Aleph::ArcPair = std::tuple< typename GT::Arc *, typename GT::Node * > |
| Alias used for encapsulating a pair of arc and node (related between them). | |
| template<class GT > | |
| using | Aleph::_Out_Iterator = Digraph_Iterator< GT, __Out_Filt< GT > > |
| Basic iterator for outcoming arcs of a node. | |
| template<class GT > | |
| using | Aleph::_In_Iterator = Digraph_Iterator< GT, __In_Filt< GT > > |
| Basic iterator for incoming arcs of a node. | |
| template<class GT > | |
| using | Aleph::Distinct_Count_Mo_On_Trees = Gen_Mo_On_Trees< GT, Distinct_Count_Policy< typename GT::Node::Node_Type > > |
| Mo on Trees specialised for counting distinct node values. | |
| template<class GT > | |
| using | Aleph::Powerful_Array_Mo_On_Trees = Gen_Mo_On_Trees< GT, Powerful_Array_Policy< typename GT::Node::Node_Type > > |
| Mo on Trees specialised for the "powerful array" query. | |
| template<class GT > | |
| using | Aleph::Range_Mode_Mo_On_Trees = Gen_Mo_On_Trees< GT, Range_Mode_Policy< typename GT::Node::Node_Type > > |
| Mo on Trees specialised for range mode queries. | |
| template<typename __Graph_Node = Graph_Snode<int>, typename __Graph_Arc = Graph_Sarc<int>> | |
| using | Aleph::List_SDigraph = Digraph< List_SGraph< __Graph_Node, __Graph_Arc > > |
| Directed graph (digraph) implemented with simple adjacency lists. | |
Functions | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::compute_maximum_cardinality_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA()) |
| Computes a maximum cardinality matching in a general graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::blossom_maximum_cardinality_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA()) |
| Alias of compute_maximum_cardinality_general_matching(). | |
| template<AlephGraph GT, class Weight = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Blossom_Weighted_Result< long long > | Aleph::compute_maximum_weight_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false) |
| Compute maximum-weight matching in a general undirected graph. | |
| template<AlephGraph GT, class Weight = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Blossom_Weighted_Result< long long > | Aleph::blossom_maximum_weight_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false) |
| Alias for compute_maximum_weight_general_matching(). | |
| template<class GT , class Func > | |
| auto | Aleph::with_clean_cookies (GT &g, Func &&func) -> decltype(func()) |
| Convenience function to run an algorithm with automatic cookie cleanup. | |
| template<class GT , class Func > | |
| auto | Aleph::with_saved_cookies (GT &g, Func &&func) -> decltype(func()) |
| Convenience function to run an algorithm preserving existing cookies. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< std::pair< typename GT::Node *, typename GT::Node * > > | Aleph::compute_dominators (GT &g, typename GT::Node *root, SA sa=SA()) |
| Compute immediate dominators of a digraph from a root node. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::build_dominator_tree (GT &g, typename GT::Node *root, GT &tree, SA sa=SA()) |
| Build the dominator tree of a digraph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > | Aleph::compute_dominance_frontiers (GT &g, typename GT::Node *root, SA sa=SA()) |
| Compute dominance frontiers of a digraph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< std::pair< typename GT::Node *, typename GT::Node * > > | Aleph::compute_post_dominators (const GT &g, typename GT::Node *exit_node, SA sa=SA()) |
| Compute immediate post-dominators of a digraph from an exit node. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::build_post_dominator_tree (const GT &g, typename GT::Node *exit_node, GT &tree, SA sa=SA()) |
| Build the post-dominator tree of a digraph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > | Aleph::compute_post_dominance_frontiers (const GT &g, typename GT::Node *exit_node, SA sa=SA()) |
| Compute post-dominance frontiers of a digraph. | |
| template<AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Df_Low_Tree_Node * | Aleph::build_df_low_tree (const GT &g, typename GT::Node *src, DynList< Df_Low_Non_Tree_Arc > &non_tree_arcs, Node_Label node_label=Node_Label(), SA sa=SA()) |
| Build the depth-first spanning tree of an undirected graph, with the df and low numbers of its nodes. | |
| template<class Write = Write_Df_Tree_Low, AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::write_df_low_tree (const GT &g, typename GT::Node *src, std::ostream &out, Node_Label node_label=Node_Label(), SA sa=SA()) |
Write, for ntreepic, the depth-first spanning tree of an undirected graph with the df and low numbers of its nodes. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA> | |
| void | Aleph::generate_graphpic (const GT &g, const double &xdist, const double &ydist, std::ostream &output, SA sa=SA()) |
| Generate a graphpic specification for graph visualization. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , class Dashed_Node , class Dashed_Arc , ArcFilter< GT > SA, NodeFilter< GT > SN> | |
| void | Aleph::generate_graphviz (const GT &g, std::ostream &output, const std::string &rankdir="TB", float ranksep=0.2, float nodesep=0.2, SA sa=SA()) |
| Generate a Graphviz DOT specification for graph visualization. | |
| template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA> | |
| void | Aleph::generate_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="TB", SA sa=SA()) |
| Generate Graphviz DOT output with custom attribute functors. | |
| template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA> | |
| void | Aleph::digraph_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="LR", SA sa=SA()) |
| Generate Graphviz DOT output specifically for digraphs. | |
| template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA> | |
| size_t | Aleph::rank_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="LR", SA sa=SA()) |
| Generate Graphviz DOT output with topological ranking. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA> | |
| void | Aleph::generate_cross_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA()) |
| Generate a cross-graph layout specification for graphpic. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA> | |
| void | Aleph::generate_net_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA()) |
| Generate a net-graph layout specification for graphpic. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA> | |
| void | generate_cross_spanning_tree (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ofstream &output, SA sa=SA()) |
| Generate a cross-layout visualization of a spanning tree. | |
| template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA> | |
| void | generate_net_spanning_tree (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ofstream &output, SA sa=SA()) |
| Generate a net-layout visualization of a spanning tree. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::greedy_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA()) |
| Greedy graph coloring in iteration order. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::welsh_powell_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA()) |
| Welsh-Powell graph coloring. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::dsatur_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA()) |
| DSatur graph coloring (saturation-degree heuristic). | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| bool | Aleph::is_valid_coloring (const GT &g, const DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA()) |
| Validates a graph coloring. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::chromatic_number (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA()) |
| Computes the exact chromatic number of a small graph. | |
| template<AlephGraph GT, typename Key , class Convert , ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Tree_Node< Key > * | Aleph::graph_to_tree_node (GT &g, typename GT::Node *groot, SA sa=SA()) |
| Convert a tree graph to a Tree_Node structure. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Howard_Mean_Cycle_Result< GT, typename Distance::Distance_Type > | Aleph::howard_minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA(), const size_t max_fallback_bytes=std::numeric_limits< size_t >::max()) |
| Minimum mean cycle by Howard's policy iteration. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Mean_Cycle_Value_Result | Aleph::howard_minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA(), const size_t max_fallback_bytes=std::numeric_limits< size_t >::max()) |
| Minimum mean cycle value by Howard's policy iteration, without the witness. | |
| template<typename Cost_Type > | |
| Hungarian_Result< Cost_Type > | Aleph::hungarian_assignment (const DynMatrix< Cost_Type > &cost) |
| Compute minimum-cost assignment (free function). | |
| template<typename Cost_Type > | |
| Hungarian_Result< Cost_Type > | Aleph::hungarian_max_assignment (const DynMatrix< Cost_Type > &cost) |
| Compute maximum-profit assignment (free function). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> requires std::is_arithmetic_v<typename Distance::Distance_Type> | |
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > | Aleph::yen_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA()) |
| Compute k shortest loopless paths using Yen's algorithm. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> requires std::is_arithmetic_v<typename Distance::Distance_Type> | |
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > | Aleph::eppstein_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA()) |
| Compute k shortest general (loopy) paths. | |
| template<AlephGraph GT> | |
| void | Aleph::kosaraju_connected_components (const GT &g, DynList< GT > &blk_list, DynList< typename GT::Arc * > &arc_list) |
| Compute strongly connected components using Kosaraju's algorithm. | |
| template<AlephGraph GT> | |
| DynList< DynList< typename GT::Node * > > | Aleph::kosaraju_connected_components (const GT &g) |
| Compute strongly connected components as lists of nodes. | |
| template<AlephGraph GT> | |
| size_t | Aleph::kosaraju_scc_count (const GT &g) |
| Count the number of strongly connected components. | |
| template<AlephGraph GT> | |
| bool | Aleph::is_strongly_connected (const GT &g) |
| Check if a directed graph is strongly connected. | |
| template<AlephGraph GT, class Compare , class Plus > | |
| void | Aleph::floyd_all_shortest_paths (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path) |
| Compute all-pairs shortest paths using Floyd-Warshall algorithm. | |
| template<AlephGraph GT, class Compare , class Plus , template< class > class P_i, template< class > class P_ij, template< class > class D_ij> | |
| void | Aleph::floyd_all_shortest_paths_latex (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path, std::ofstream &output) |
| Floyd-Warshall algorithm with LaTeX step-by-step output. | |
| void | Aleph::split (const std::string &text, const std::string &separators, DynDlist< std::string > &words) |
| Split a text into tokens using a separator set. | |
| Digrafo::Node * | Aleph::search_node (Digrafo &g, const std::string &s) |
| Find or create a node by ID. | |
| void | Aleph::load_digraph (Digrafo &g, std::istream &nodes_input, std::istream &arcs_input) |
| Load nodes and arcs from streams into the directed graph. | |
| void | Aleph::generate_dot_file (Digrafo &g, std::ostream &output) |
| Generate a DOT representation of the digraph. | |
| template<class Mat , class Compare = std::less<>> | |
| void | Aleph::find_min_path (Mat &p, long src_idx, long tgt_idx, Path< typename Mat::Graph_Type > &path) |
| Build a minimum path from Floyd-Warshall path matrix using indices. | |
| template<class Mat , class Compare = std::less<>> | |
| void | Aleph::find_min_path (Mat &p, typename Mat::Node *src_node, typename Mat::Node *tgt_node, Path< typename Mat::Graph_Type > &path) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Build a minimum path using node pointers instead of indices. | |
| template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Cost_Matching_Result< long long > | Aleph::compute_minimum_cost_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA(), const bool max_cardinality=false) |
| Compute minimum-cost matching in a general undirected graph. | |
| template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Cost_Matching_Result< long long > | Aleph::blossom_minimum_cost_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA(), const bool max_cardinality=false) |
| Alias for compute_minimum_cost_general_matching(). | |
| template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Cost_Perfect_Matching_Result< long long > | Aleph::compute_minimum_cost_perfect_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA()) |
| Compute minimum-cost perfect matching in a general undirected graph. | |
| template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Cost_Perfect_Matching_Result< long long > | Aleph::blossom_minimum_cost_perfect_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA()) |
| Alias for compute_minimum_cost_perfect_general_matching(). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > | Aleph::karp_minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA()) |
| Compute minimum mean cycle by Karp's algorithm. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Mean_Cycle_Value_Result | Aleph::karp_minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA()) |
| Compute only the minimum mean value (without witness walk). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Mean_Cycle_Value_Result | Aleph::minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA()) |
Alias for karp_minimum_mean_cycle_value(). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > | Aleph::minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA()) |
Alias for karp_minimum_mean_cycle(). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< Negative_Cycle_Item< GT, typename Distance::Distance_Type > > | Aleph::find_disjoint_negative_cycles (const GT &g, const size_t max_cycles, const Negative_Cycle_Exclusion exclusion=Negative_Cycle_Exclusion::Min_Weight_Arc, Distance distance=Distance(), SA sa=SA()) |
Find up to max_cycles negative cycles, excluding arcs of each cycle found before searching for the next one. | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Bounded_Cycle_Result< GT, typename Distance::Distance_Type > | Aleph::most_negative_cycle_bounded (const GT &g, const size_t max_length, Distance distance=Distance(), SA sa=SA()) |
Most negative simple cycle of at most max_length arcs, ranked by total cost (not by mean cost as Karp's algorithm does). | |
| template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Short_Cycle_Result< GT, typename Distance::Distance_Type > | Aleph::most_negative_cycle_up_to_3 (const GT &g, const size_t max_length=3, Distance distance=Distance(), SA sa=SA()) |
| Minimum-total-cost simple cycle with at most one, two or three arcs. | |
| const char * | Aleph::to_string (const Planarity_Certificate_Type type) noexcept |
| Return readable name for certificate type. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Planarity_Test_Result< GT > | Aleph::planarity_test (const GT &g, SA sa=SA(), const Planarity_Test_Options &options=Planarity_Test_Options()) |
| Execute a comprehensive planarity test on an Aleph graph. | |
| template<AlephGraph GT> | |
| Planarity_Test_Result< GT > | Aleph::planarity_test (const GT &g, const Planarity_Test_Options &options) |
| Overload with default arc selector. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| bool | Aleph::is_planar_graph (const GT &g, SA sa=SA(), const Planarity_Test_Options &options=Planarity_Test_Options()) |
| High-level boolean check for graph planarity. | |
| template<AlephGraph GT> | |
| bool | Aleph::is_planar_graph (const GT &g, const Planarity_Test_Options &options) |
| Overload with default arc selector. | |
| template<AlephGraph GT> | |
| Planar_Dual_Metadata< GT > | Aleph::planar_dual_metadata (const Planarity_Test_Result< GT > &result) |
| Build face and dual-edge metadata from a planar embedding result. | |
| template<AlephGraph GT, class DGT = Default_Planar_Dual_Graph<GT>> | |
| DGT | Aleph::build_planar_dual_graph (const Planar_Dual_Metadata< GT > &md) |
| Build an Aleph dual graph from face/dual metadata. | |
| template<AlephGraph GT, class DGT = Default_Planar_Dual_Graph<GT>> | |
| DGT | Aleph::build_planar_dual_graph (const Planarity_Test_Result< GT > &result) |
| Build an Aleph dual graph directly from a planarity result. | |
| template<AlephGraph GT> | |
| Planar_Geometric_Drawing< GT > | Aleph::planar_geometric_drawing (const Planarity_Test_Result< GT > &result, const Planar_Geometric_Drawing_Options &options=Planar_Geometric_Drawing_Options()) |
| Build embedding-aware 2D node coordinates from a planar result. | |
| template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>> | |
| std::string | Aleph::nonplanar_certificate_to_json (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options()) |
| Export non-planar certificate as JSON. | |
| template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>> | |
| std::string | Aleph::nonplanar_certificate_to_dot (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options()) |
| Export non-planar certificate as GraphViz DOT. | |
| template<AlephGraph GT> | |
| NonPlanar_Certificate_Validation< GT > | Aleph::validate_nonplanar_certificate (const Planarity_Test_Result< GT > &result) |
| Validate structural consistency of a non-planar certificate. | |
| template<AlephGraph GT> | |
| bool | Aleph::nonplanar_certificate_is_valid (const Planarity_Test_Result< GT > &result) |
Convenience predicate over validate_nonplanar_certificate(). | |
| template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>> | |
| std::string | Aleph::nonplanar_certificate_to_graphml (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options()) |
| Export non-planar certificate as GraphML. | |
| template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>> | |
| std::string | Aleph::nonplanar_certificate_to_gexf (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options()) |
| Export non-planar certificate as GEXF. | |
| GT | Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::sufficient_hamiltonian (const size_t &__num_nodes, const double &p=0.5) |
| Create a random Hamiltonian graph. | |
| GT | Aleph::Random_Graph< GT, Init_Node, Init_Arc >::sufficient_hamiltonian (const size_t &__num_nodes, const double &p=0.5) |
| Create a random Hamiltonian graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::compute_bipartite (const GT &g, DynDlist< typename GT::Node * > &l, DynDlist< typename GT::Node * > &r, SA sa=SA()) |
| Computes the partition sets of a bipartite graph. | |
| template<AlephGraph GT, template< class > class Max_Flow = Ford_Fulkerson_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::compute_maximum_cardinality_bipartite_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA()) |
| Computes the maximum cardinality matching of a bipartite graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| bool | Aleph::compute_bipartite_all_components (const GT &g, DynDlist< typename GT::Node * > &l, DynDlist< typename GT::Node * > &r, SA sa=SA()) |
| Computes the partition sets of a bipartite graph handling all connected components. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::hopcroft_karp_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA()) |
| Computes a maximum cardinality matching on a bipartite graph using the Hopcroft-Karp algorithm. | |
| template<AlephGraph GT> | |
| Const_Graph_View< GT > | Aleph::const_view (const GT &g) noexcept |
| Strict read-only view of a graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Arc * > | Aleph::find_bridges (const GT &g, typename GT::Node *start, SA sa=SA()) |
| Find all bridge edges in a connected undirected graph. | |
| template<class T , class... Args> | |
| Dfs_Here< T > | Aleph::dfs_here (Args &&...args) |
| Builds the variable of the frame of a search, with the frame built with args. | |
| template<class T > | |
| T & | Aleph::dfs_frame (T &here) noexcept |
| The frame that a Dfs_Here holds. | |
| template<class T > | |
| T & | Aleph::dfs_frame (std::optional< T > &here) noexcept |
| The frame that a Dfs_Here holds. | |
| template<class T , class... Args> | |
| void | Aleph::dfs_replace (T &here, Args &&...args) |
| Replaces the frame that a Dfs_Here holds with one built with args, by assignment. | |
| template<class T , class... Args> | |
| void | Aleph::dfs_replace (std::optional< T > &here, Args &&...args) |
| Replaces the frame that a Dfs_Here holds with one built in its place with args. | |
| template<class It > | |
| decltype(auto) | Aleph::dfs_curr (const It &it) |
| The current item of an iterator that has one. | |
| template<AlephGraph GT, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op > requires std::is_invocable_r_v<void, Op &, typename GT::Node *> | |
| void | Aleph::for_each_node (const GT &g, Op operation, SN sn=SN()) |
| Traverse all the nodes of graph filtering some ones according to a condition and executing an operation on them. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<void, Op &, typename GT::Arc *> | |
| void | Aleph::for_each_arc (const GT &g, Op operation, SA sa=SA()) |
| Traverse all the arcs of graph filtering some ones according to a condition and executing an operation on them. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<void, Op &, typename GT::Arc *> | |
| void | Aleph::for_each_arc (const GT &g, typename GT::Node *p, Op operation, SA sa=SA()) |
| Traverse all the arcs adjacent to a node filtering some ones according to a condition and executing an operation on them. | |
| template<AlephGraph GT, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op > requires std::is_invocable_r_v<bool, Op &, typename GT::Node *> | |
| bool | Aleph::forall_node (const GT &g, Op cond, SN sn=SN()) |
Return true if condition cond is met on every filtered node of the graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<bool, Op &, typename GT::Arc *> | |
| bool | Aleph::forall_arc (const GT &g, Op cond, SA sa=SA()) |
Return true if condition cond is met on every filtered arc of the graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<bool, Op &, typename GT::Arc *> | |
| bool | Aleph::forall_arc (typename GT::Node *p, Op cond, SA sa=SA()) |
Return true if the condition cond is met on every filtered arc of a node. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op > requires std::is_invocable_r_v<T, Op &, typename GT::Node *> | |
| Container< T > | Aleph::nodes_map (GT &g, Op transformation, SN sn=SN()) |
| Map the filtered nodes of a graph to a transformed type. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, NodeFilter< GT > SN = Dft_Show_Node<GT>> | |
| Container< T > | Aleph::nodes_map (GT &g, std::function< T(typename GT::Node *)> transformation, SN sn=SN()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload for callers that pass an actual std::function<T (typename GT::Node *)> (rather than a lambda or other callable) and rely on T being deduced from it, as the generic overload above cannot: T appears only in its return type and requires clause, never in a parameter, so it is not a deduced context there. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<T, Op &, typename GT::Arc *> | |
| Container< T > | Aleph::arcs_map (GT &g, Op transformation, SA sa=SA()) |
| Map the filtered arcs of a graph to a transformed type. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Container< T > | Aleph::arcs_map (GT &g, std::function< T(typename GT::Arc *)> transformation, SA sa=SA()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<T, Op &, typename GT::Arc *> | |
| Container< T > | Aleph::arcs_map (GT &g, typename GT::Node *p, Op transformation, SA sa=SA()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Map the filtered arcs of a specific node in a graph to a transformed type. | |
| template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| Container< T > | Aleph::arcs_map (GT &g, typename GT::Node *p, std::function< T(typename GT::Arc *)> transformation, SA sa=SA()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it. | |
| template<AlephGraph GT, typename T , NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op > requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Node *> | |
| T | Aleph::foldl_nodes (GT &g, const T &init, Op operation, SN sn=SN()) |
| Fold the filtered nodes of a graph. | |
| template<AlephGraph GT, typename T , ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *> | |
| T | Aleph::foldl_arcs (GT &g, const T &init, Op operation, SA sa=SA()) |
| Fold the filtered arcs of a graph. | |
| template<AlephGraph GT, typename T , ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op > requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *> | |
| T | Aleph::foldl_arcs (GT &g, typename GT::Node *p, const T &init, Op operation, SA sa=SA()) |
| Fold the filtered adjacent arcs of a node. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Node * > | Aleph::out_nodes (typename GT::Node *p, SA sa=SA()) |
Return the nodes connected to the filtered outcoming arcs of p. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Node * > | Aleph::in_nodes (typename GT::Node *p, SA sa=SA()) |
Return the nodes connected to the filtered incoming arcs to p. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Node * > | Aleph::in_nodes (const GT &g, typename GT::Node *p, SA sa=SA()) |
Return the sources of the arcs of g into p that sa shows. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Arc * > | Aleph::out_arcs (typename GT::Node *p, SA sa=SA()) |
Return the filtered incoming arcs of p. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Arc * > | Aleph::in_arcs (typename GT::Node *p, SA sa=SA()) |
Return the filtered incoming arcs of p. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Arc * > | Aleph::in_arcs (const GT &g, typename GT::Node *p, SA sa=SA()) |
Return the arcs of g into p that sa shows. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< typename GT::Arc * > | Aleph::arcs (typename GT::Node *p, SA sa=SA()) |
Return all the filtered arcs related to p | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< ArcPair< GT > > | Aleph::in_pairs (typename GT::Node *p, SA sa=SA()) |
Return the filtered incoming pairs of (arc,node) related to node p | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< ArcPair< GT > > | Aleph::in_pairs (const GT &g, typename GT::Node *p, SA sa=SA()) |
Return the pairs (arc, source) of the arcs of g into p that sa shows. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| DynList< ArcPair< GT > > | Aleph::out_pairs (typename GT::Node *p, SA sa=SA()) |
Return the filtered outcoming pairs of (arc,node) related to node p | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::in_degree (typename GT::Node *p, SA sa=SA()) |
Compute the filtered in degree of node p. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::in_degree (const GT &g, typename GT::Node *p, SA sa=SA()) |
Compute the number of arcs of g into p that sa shows. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| size_t | Aleph::out_degree (typename GT::Node *p, SA sa=SA()) |
Compute the filtered out degree of node p | |
| template<AlephGraph GT, class Itor , class Operation > | |
| bool | Aleph::traverse_arcs (typename GT::Node *p, Operation op=Operation()) |
| Generic arcs traverse of a node. | |
| template<AlephGraph GT, class Itor , class Operation > | |
| void | Aleph::for_each_arc (typename GT::Node *p, Operation op=Operation()) |
| Execute an operation on each arc of a node. | |
| template<AlephGraph GT, class Op > | |
| bool | Aleph::traverse_in_arcs (typename GT::Node *p, Op op=Op()) |
| Conditioned traversal of incoming arcs of a node. | |
| template<AlephGraph GT, class Op > | |
| bool | Aleph::traverse_in_arcs (const GT &g, typename GT::Node *p, Op op=Op()) |
Conditioned traversal of the arcs of g into p. | |
| template<AlephGraph GT, class Op > | |
| void | Aleph::for_each_in_arc (typename GT::Node *p, Op op=Op()) |
| Traverse the incoming arcs of a node and executes an operation. | |
| template<AlephGraph GT, class Op > | |
| void | Aleph::for_each_in_arc (const GT &g, typename GT::Node *p, Op op=Op()) |
Executes an operation on each arc of g into p: on a digraph, which the function tells at run time, among the arcs of the graph, in \(O(E)\). | |
| template<AlephGraph GT, typename T , class Op = std::function<T (typename GT::Arc *)>> requires std::is_same_v<Op, std::function<T (typename GT::Arc *)>> | |
| auto | Aleph::map_in_arcs (typename GT::Node *p, std::function< T(typename GT::Arc *)> op) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it. | |
| template<AlephGraph GT, typename T > | |
| auto | Aleph::map_in_arcs (const GT &g, typename GT::Node *p, std::function< T(typename GT::Arc *)> op) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument. | |
| template<AlephGraph GT, class Op > | |
| bool | Aleph::traverse_out_arcs (typename GT::Node *p, Op op=Op()) |
| Conditioned traversal of outcoming arcs of a node. | |
| template<AlephGraph GT, class Op > | |
| void | Aleph::for_each_out_arc (typename GT::Node *p, Op op=Op()) |
| Traverse the outcoming arcs of a node and executes an operation. | |
| template<AlephGraph GT, typename T , class Op = std::function<T (typename GT::Arc *)>> requires std::is_same_v<Op, std::function<T (typename GT::Arc *)>> | |
| auto | Aleph::map_out_arcs (typename GT::Node *p, std::function< T(typename GT::Arc *)> op) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| GT::Arc * | Aleph::search_arc (const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept(nothrow_arc_filter_v< GT, SA >) |
| Arc filtered searching given two nodes. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| GT::Arc * | Aleph::search_directed_arc (const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept(nothrow_arc_filter_v< GT, SA >) |
| Searching of directed arc linking two nodes. | |
| template<AlephGraph GT> | |
| GT::Node * | Aleph::mapped_node (typename GT::Node *p) noexcept |
Return the mapped node through the cookie of p | |
| template<AlephGraph GT> | |
| void | Aleph::copy_graph (GT >gt, const GT &gsrc, bool cookie_map=false) |
| Explicit copy of graph. | |
| template<AlephGraph GT> | |
| void | Aleph::clear_graph (GT &g) |
| Clean a graph: all its nodes and arcs are removed and freed. | |
| template<AlephGraph GT> | |
| Path< GT > | Aleph::find_path_depth_first (const GT &g, typename GT::Node *start_node, typename GT::Node *end_node) |
| Depth-first search of a path between two nodes. | |
| template<AlephGraph GTS, AlephGraph GTT> | |
| void | Aleph::map_nodes (typename GTS::Node *p, typename GTT::Node *q) noexcept |
| Map two nodes of different types of graphs through their cookies. | |
| template<AlephGraph GTS, AlephGraph GTT> | |
| void | Aleph::map_arcs (typename GTS::Arc *p, typename GTT::Arc *q) noexcept |
| Map two arcs of different types of graphs through their cookies. | |
| template<AlephGraph GTT, AlephGraph GTS, class Copy_Node = Dft_Copy_Node<GTT, GTS>, class Copy_Arc = Dft_Copy_Arc<GTT, GTS>> | |
| void | Aleph::inter_copy_graph (GTT >gt, const GTS &gsrc, const bool cookie_map=false) |
| Copy between different types of graphs. | |
| template<AlephGraph GT> | |
| size_t | Aleph::depth_first_traversal (const GT &g, typename GT::Node *start_node, bool(*visit)(const GT &g, typename GT::Node *, typename GT::Arc *)) |
| Depth-first traversal starting from a given node. | |
| template<AlephGraph GT> | |
| size_t | Aleph::breadth_first_traversal (const GT &g, typename GT::Node *start, bool(*visit)(const GT &, typename GT::Node *, typename GT::Arc *)) |
| Breadth-first traversal starting from a given node. | |
| template<AlephGraph GT> | |
| Path< GT > | Aleph::find_path_breadth_first (const GT &g, typename GT::Node *start, typename GT::Node *end) |
| Breadth-first search of a (shortest-by-edges) path between two nodes. | |
| template<AlephGraph GT> | |
| bool | Aleph::test_connectivity (const GT &g) |
| Connectivity test for undirected graphs. | |
| template<AlephGraph GT> | |
| bool | Aleph::test_for_cycle (const GT &g, typename GT::Node *src) |
| Search for a cycle reachable from a given node. | |
| template<AlephGraph GT> | |
| bool | Aleph::is_graph_acyclique (const GT &g, typename GT::Node *start_node) |
Return true if an undirected graph is acyclic. | |
| template<AlephGraph GT> | |
| bool | Aleph::is_graph_acyclique (const GT &g) |
Return true if an undirected graph is acyclic. | |
| template<AlephGraph GT> | |
| bool | Aleph::has_cycle (const GT &g) |
Return true if an undirected graph has at least one cycle. | |
| template<AlephGraph GT> | |
| bool | Aleph::test_for_path (const GT &g, typename GT::Node *start_node, typename GT::Node *end_node) |
Return true if there is a path between two nodes. | |
| template<AlephGraph GT> | |
| DynList< GT > | Aleph::inconnected_components (const GT &g) |
| Forward declaration for inconnected_components(). | |
| template<AlephGraph GT> | |
| void | Aleph::build_subgraph (const GT &g, GT &sg, typename GT::Node *g_src, size_t &node_count) |
| Forward declaration for build_subgraph(). | |
| template<AlephGraph GT> | |
| GT | Aleph::find_depth_first_spanning_tree (const GT &g, typename GT::Node *gnode) |
| Build a depth-first spanning tree (mapped to the original graph). | |
| template<AlephGraph GT> | |
| GT | Aleph::find_breadth_first_spanning_tree (GT &g, typename GT::Node *gp) |
| Build a breadth-first spanning tree (mapped to the original graph). | |
| template<AlephGraph GT> | |
| GT | Aleph::build_spanning_tree (const DynArray< typename GT::Arc * > &arcs) |
| Build a graph from a list of arcs (typically a spanning tree). | |
| template<AlephGraph GT> | |
| DynList< typename GT::Node * > | Aleph::compute_cut_nodes (const GT &g, typename GT::Node *start) |
| Compute articulation points (cut vertices) of an undirected graph. | |
| template<AlephGraph GT> | |
| long | Aleph::paint_subgraphs (const GT &g, const DynList< typename GT::Node * > &cut_node_list) |
| Paint connected blocks around articulation points. | |
| template<AlephGraph GT> | |
| GT | Aleph::map_subgraph (const GT &g, const long color) |
| Extract a mapped subgraph containing a given color. | |
| template<AlephGraph GT> | |
| std::tuple< GT, DynList< typename GT::Arc * > > | Aleph::map_cut_graph (const GT &g, const DynList< typename GT::Node * > &cut_node_list) |
| Extract the cut graph and cross-arc list. | |
| template<AlephGraph GT> | |
| GT | Aleph::invert_digraph (const GT &g) |
| Compute the transpose (arc-reversed) digraph. | |
| template<AlephGraph GT, template< class > class Max_Flow = Random_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| long | Aleph::edge_connectivity (GT &g, SA sa=SA()) |
| Compute edge connectivity (arc connectivity) of an undirected graph. | |
| template<AlephGraph GT, template< class > class Max_Flow = Heap_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| long | Aleph::compute_min_cut (GT &g, DynSetTree< typename GT::Node * > &l, DynSetTree< typename GT::Node * > &r, DynDlist< typename GT::Arc * > &cut, SA sa=SA()) |
| Compute a minimum edge cut of an undirected graph. | |
| template<AlephGraph GT, template< class > class Max_Flow = Random_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| long | Aleph::vertex_connectivity (GT &g, SA sa=SA()) |
| Compute vertex connectivity of an undirected graph. | |
| template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>> | |
| void | Aleph::warshall_compute_transitive_clausure (GT &g, Bit_Mat_Graph< GT, SA > &mat, SA sa=SA()) |
| Computes the transitive closure of a graph using Warshall's algorithm. | |
Variables | |
| const unsigned char | Aleph::Processed = 2 |
| The node or arc has already been processed. | |
| const unsigned char | Aleph::Processing = 1 |
| The node are being processed; probably it is inside a queue, stack or heap. | |
| const unsigned char | Aleph::Unprocessed = 0 |
| The node have not bees processed. | |
| template<class GT , class SA > | |
| constexpr bool | Aleph::nothrow_arc_filter_v |
| Whether a filter of type SA of the arcs of GT is copied, moved and called without exceptions: then an iterator that it filters, and a search through one, throw nothing. | |
| bool | Aleph::with_power = false |
| Configuration options for DOT file generation. | |
| bool | Aleph::with_nes = false |
| If true, include NES percentage in node labels. | |
| bool | Aleph::only_num = false |
| If true, show only the node number, not the full label. | |
| bool | Aleph::with_class = false |
| If true, set node shapes based on class field. | |
| size_t | Aleph::font_size = 6 |
| Font size for the DOT output. | |
| bool | Aleph::vertical = true |
| If true, use vertical layout (default). | |
The graph classes export several iterators: Node_Iterator, Arc_Iterator, Node_Arc_Iterator, Out_Iterator and In_Iterator. These iterators are exported as subclasses of the graph class. Suppose, for example, that you are using a class Map based on Array_Graph class (but it could have perfectly been base on any other graph class) and the graph is named g. Then, you could iterate on all the arcs through some such as:
for (auto it = g.get_arc_it(); it.has_cur(); it.next()) auto arc = it.get_curr(); // each arc of the graph is seen
Now, there are several, perhaps many, situations where not all the arcs must be processed, but a subset of them satisfying a particular condition. In these cases, the filtered iterator come for us.
As seen in the class Filter_Iterator, a filtered iterator is almost exactly the same thing as a normal iterator. The subtle difference is that on it operates a filter condition that filters all the items satisfying a special condition. Let's show a brief but constructive example.
Suppose that your graph represents pathways of automotive transportation. Nodes are the cities and arcs are the pathways. Now suppose that your pathways are classified in Highway, Road and Trail. Now suppose that you wish to solve a problem that only involves highways; for example, you want to find the shortest path between two cities connected by only highways. Then you could specify a filter that catches highways:
struct Only_Highway { bool operator () (GT::Arc * a) { return a->get_info().type == Highway; } };
Now, if your shortest path algorithm receives this filter, this will only see highways and its results will only contain highways.
For each subclass iterator on a graph, it is exported a filtered iterator with the same name of subclassed one. Thus, for the subclass GT::Arc_Iterator exists a filtered version named Arc_Iterator and so on for the remainder iterator subclasses on the graphs.
The filtered iterators have a great importance in Aleph-w ( \(\aleph_\omega\)) algorithms on graphs, since almost every algorithm operates with filtered iterator.
The short answer is: almost always!
Filtered iterators have of course a light but constant impact on performance. For each seen graph object a boolean predicate is tested. So, if you know that your algorithm does not require to filter, the use the subclass iterator. But if, in pursuit of generalization your algorithm could profit the filtered version, then design your algorithm on filtered iterator. In this way you will provide generality, which allows to reuse algorithms in a transparent way.
A very good and concrete example of intensive use of filtered iterator is for solving the problem of maximizing a network flow at minimum cost. First, in order to manage the residual net, the arcs are filtered according to source node. Second, the residual cut arcs are also filtered according to flow value; if the flow is equal to the capacity then the arc is filtered. Third, in order to detect negative cycles the Bellman-Ford algorithm is used with a filter that only sees the arcs cost.
| #define ALEPH_FLATTEN [[gnu::flatten]] |
[[gnu::flatten]], or nothing where it would only make the compilation slower.
The depth-first searches put it, with [[gnu::always_inline]], on the functions that they call for each node or arc, so that the compiler inlines into them all that they call: GCC would leave out of line the iterators and the stack, which then cost more than a recursion. It makes the compilation take more time and memory, for nothing in a build that does not inline or that has sanitizers, so that it is empty:
ALEPH_NO_FLATTEN defined, as the build defines it with ALEPH_USE_SANITIZERS, for UndefinedBehaviorSanitizer, which defines no macro;__NO_INLINE__, as with -O0. Definition at line 89 of file tpl_dfs_stack.H.
| #define ALEPH_GRAPH_COPY_MOVE_CTORS | ( | GraphClass | ) |
Macro to generate copy/move constructors and assignment operators.
This macro generates the standard copy constructor, move constructor, copy assignment operator, and move assignment operator for graph classes.
Requirements for the graph class:
swap(GraphClass&) methodcopy_graph(dest, src)| GraphClass | The name of the graph class |
Usage example:
Definition at line 4311 of file graph-dry.H.
| #define ARC_BITS | ( | p | ) | ((p)->attrs.control_bits) |
Return the control bits of arc p.
Definition at line 379 of file aleph-graph.H.
| #define ARC_COLOR | ( | p | ) | ((p)->attrs.counter) |
Return the color of arc p.
Definition at line 373 of file aleph-graph.H.
| #define ARC_COOKIE | ( | p | ) | ((p)->attrs.cookie) |
Return the arc cookie
Definition at line 394 of file aleph-graph.H.
| #define ARC_COUNTER | ( | p | ) | ((p)->attrs.counter) |
Return the counter of arc p.
Definition at line 367 of file aleph-graph.H.
| #define IS_ARC_VISITED | ( | p, | |
| bit | |||
| ) | (ARC_BITS(p).get_bit(bit)) |
Determine whether the bit field is or not set to one.
| p | pointer to arc |
| bit | number of bit to be read |
bit is 1; false otherwise (bit is set to 0) Definition at line 388 of file aleph-graph.H.
| #define IS_NODE_VISITED | ( | p, | |
| bit | |||
| ) | (NODE_BITS(p).get_bit(bit)) |
Determine whether the control bit is set or not to one.
| p | pointer to the node |
| bit | number of bit to read |
Definition at line 355 of file aleph-graph.H.
| #define NODE_BITS | ( | p | ) | ((p)->attrs.control_bits) |
Get the control bits of a node.
Definition at line 333 of file aleph-graph.H.
| #define NODE_COLOR | ( | p | ) | ((p)->attrs.counter) |
Synonymous of NODE_COUNTER.
Definition at line 345 of file aleph-graph.H.
| #define NODE_COOKIE | ( | p | ) | ((p)->attrs.cookie) |
Return the node cookie
Definition at line 361 of file aleph-graph.H.
| #define NODE_COUNTER | ( | p | ) | ((p)->attrs.counter) |
Get the counter of a node.
Definition at line 339 of file aleph-graph.H.
| using Aleph::_In_Iterator = typedef Digraph_Iterator<GT, __In_Filt<GT> > |
Basic iterator for incoming arcs of a node.
It walks the list of the node, which holds the arcs that enter it only in a graph that is not directed, as the networks are. It does not compile on a digraph type (DigraphType), whose list of a node holds only the arcs that leave it, so that the iterator would see only the loops of the node: use In_Iterator(g, p) there, or In_Arcs_Index for many nodes. It cannot tell a graph of an undirected type that says that it is directed (see set_digraph()).
Definition at line 1929 of file tpl_graph.H.
| using Aleph::_Out_Iterator = typedef Digraph_Iterator<GT, __Out_Filt<GT> > |
Basic iterator for outcoming arcs of a node.
Definition at line 1911 of file tpl_graph.H.
| using Aleph::ArcPair = typedef std::tuple<typename GT::Arc *, typename GT::Node *> |
Alias used for encapsulating a pair of arc and node (related between them).
Definition at line 1702 of file tpl_graph.H.
| using Aleph::Array_Digraph = typedef Digraph<Array_Graph<__Graph_Node, __Graph_Arc> > |
Directed graph (digraph) implemented with array-based adjacency lists.
This class models a directed graph. Functionally it is equivalent to the Array_Graph class, except that this one handles directed graphs.
This is a type alias for Digraph<Array_Graph<...>>, which provides all the directed graph functionality through the generic Digraph template wrapper defined in graph-dry.H.
| __Graph_Node | The node type. Must be defined from the Graph_Anode class, either by attribute inclusion, by derivation, or by a combination of both. |
| __Graph_Arc | The arc type. Must be defined from the Graph_Aarc class, either by attribute inclusion, by derivation, or by a combination of both. |
Definition at line 708 of file tpl_agraph.H.
| using Aleph::Dfs_Here = typedef std::conditional_t<std::is_move_assignable_v<T>, T, std::optional<T> > |
The variable that holds the frame of the node that a depth-first search visits.
A search that does not recurse keeps the frame of the node that it visits in a local variable until that node visits another; then the frame waits in a Dfs_Stack, and the variable takes the frame of the next node. A frame that keeps an arc filter, in its iterator, can be assigned only if the filter can, which ArcFilter does not ask: a lambda that captures, or a filter with a reference or a const member, cannot. So the variable is the frame itself, which dfs_replace() assigns, as the searches did, if the frames can be assigned, and else an optional frame, which dfs_replace() builds again in its place. dfs_here() builds it, and dfs_frame() gives the frame that it holds.
| T | Type of the frames. |
Definition at line 591 of file tpl_dfs_stack.H.
| using Aleph::Distinct_Count_Mo_On_Trees = typedef Gen_Mo_On_Trees<GT, Distinct_Count_Policy<typename GT::Node::Node_Type> > |
Mo on Trees specialised for counting distinct node values.
| GT | Graph type. |
Definition at line 1335 of file tpl_mo_on_trees.H.
| using Aleph::List_Digraph = typedef Digraph<List_Graph<__Graph_Node, __Graph_Arc> > |
Directed graph (digraph) implemented with double-linked adjacency lists.
This class models a directed graph. Functionally, it is equivalent to the List_Graph class, except that this one handles directed graphs.
This is a type alias for Digraph<List_Graph<...>>, which provides all the directed graph functionality through the generic Digraph template wrapper defined in graph-dry.H.
| __Graph_Node | The node type. Must be defined from the Graph_Node class, either by attribute inclusion, by derivation, or by a combination of both. |
| __Graph_Arc | The arc type. Must be defined from the Graph_Arc class, either by attribute inclusion, by derivation, or by a combination of both. |
Definition at line 1693 of file tpl_graph.H.
| using Aleph::List_SDigraph = typedef Digraph<List_SGraph<__Graph_Node, __Graph_Arc> > |
Directed graph (digraph) implemented with simple adjacency lists.
This class models a directed graph. Functionally it is equivalent to the List_SGraph class, except that this one handles directed graphs.
This is a type alias for Digraph<List_SGraph<...>>, which provides all the directed graph functionality through the generic Digraph template wrapper defined in graph-dry.H.
| __Graph_Node | The node type. Must be defined from the Graph_Snode class, either by attribute inclusion, by derivation, or by a combination of both. |
| __Graph_Arc | The arc type. Must be defined from the Graph_Sarc class, either by attribute inclusion, by derivation, or by a combination of both. |
Definition at line 704 of file tpl_sgraph.H.
| using Aleph::Powerful_Array_Mo_On_Trees = typedef Gen_Mo_On_Trees<GT, Powerful_Array_Policy<typename GT::Node::Node_Type> > |
Mo on Trees specialised for the "powerful array" query.
| GT | Graph type. |
Definition at line 1344 of file tpl_mo_on_trees.H.
| using Aleph::Range_Mode_Mo_On_Trees = typedef Gen_Mo_On_Trees<GT, Range_Mode_Policy<typename GT::Node::Node_Type> > |
Mo on Trees specialised for range mode queries.
| GT | Graph type. |
Definition at line 1353 of file tpl_mo_on_trees.H.
|
strong |
How far the numbers behind the result of a cycle search can be trusted.
Reported by most_negative_cycle_bounded() and by howard_minimum_mean_cycle() (Howard_Min_Mean_Cycle.H). Later versions may add values; code that switches on it should treat an unknown value as Rounded.
| Enumerator | |
|---|---|
| Exact | Every sum and comparison that decided the result was exact: integral costs (an overflow throws instead of wrapping around), floating-point weights whose range makes every sum of the search exact, or a floating-point result verified with exact arithmetic (Howard). The result is what the algorithm computes in exact arithmetic (Howard's is then the optimum), and a certificate such as |
| Rounded | The cycle was chosen with rounded values (floating-point costs, or means compared in When weights of very different magnitudes cancel, a worse cycle can be chosen; |
Definition at line 216 of file Negative_Cycles.H.
| enum Aleph::Graph_Bits |
Bit numbers of nodes or arcs.
Nodes y arcs of graph have as control attributes (internal representation of state), a set of bits. These are their numbers named according to their use by the library.
You can use then for purposes other than the suggested name. However, be careful.
| Enumerator | |
|---|---|
| Depth_First | |
| Breadth_First | |
| Test_Cycle | |
| Find_Path | |
| Euler | |
| Maximum_Flow | |
| Spanning_Tree | |
| Build_Subtree | |
| Convert_Tree | |
| Cut | |
| Min | |
| Num_Bits_Graph | |
Definition at line 71 of file aleph-graph.H.
|
strong |
Why howard_minimum_mean_cycle() handed the problem over to Karp's algorithm (see the documentation of Howard_Min_Mean_Cycle.H).
Definition at line 199 of file Howard_Min_Mean_Cycle.H.
|
strong |
Which arcs of a found negative cycle are excluded before searching for the next one in find_disjoint_negative_cycles().
Definition at line 189 of file Negative_Cycles.H.
|
strong |
Non-planarity witness classification.
| Enumerator | |
|---|---|
| None | |
| K5_Subdivision | |
| K33_Subdivision | |
| Minimal_NonPlanar_Obstruction | |
Definition at line 119 of file Planarity_Test.H.
| DynList< typename GT::Arc * > Aleph::arcs | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return all the filtered arcs related to p
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2713 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| Container< T > Aleph::arcs_map | ( | GT & | g, |
| Op | transformation, | ||
| SA | sa = SA() |
||
| ) |
Map the filtered arcs of a graph to a transformed type.
| GT | Graph type |
| T | Result type |
| Container | Container type (default: DynList) |
| SA | Arc filter type (default: Dft_Show_Arc<GT>) |
| g | the graph |
| transformation | function Arc* -> T that transforms each arc |
| sa | arc filter functor (default: Dft_Show_Arc<GT>) |
Container<T> object with all the arcs mapped through the transformation Definition at line 1507 of file tpl_graph.H.
Referenced by Aleph::max_flow_min_cost_by_cycle_canceling().
| Container< T > Aleph::arcs_map | ( | GT & | g, |
| std::function< T(typename GT::Arc *)> | transformation, | ||
| SA | sa = SA() |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
Definition at line 1530 of file tpl_graph.H.
| Container< T > Aleph::arcs_map | ( | GT & | g, |
| typename GT::Node * | p, | ||
| Op | transformation, | ||
| SA | sa = SA() |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Map the filtered arcs of a specific node in a graph to a transformed type.
This overload filters arcs connected to a specific node p.
| GT | Graph type |
| T | Result type |
| Container | Container type (default: DynList) |
| SA | Arc filter type (default: Dft_Show_Arc<GT>) |
| g | the graph |
| p | node pointer (arcs connected to this node are filtered) |
| transformation | function Arc* -> T that transforms each arc |
| sa | arc filter functor (default: Dft_Show_Arc<GT>) |
Container<T> object with all the arcs mapped through the transformation Definition at line 1564 of file tpl_graph.H.
| Container< T > Aleph::arcs_map | ( | GT & | g, |
| typename GT::Node * | p, | ||
| std::function< T(typename GT::Arc *)> | transformation, | ||
| SA | sa = SA() |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
Definition at line 1588 of file tpl_graph.H.
| size_t Aleph::blossom_maximum_cardinality_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| SA | sa = SA() |
||
| ) |
Alias of compute_maximum_cardinality_general_matching().
This convenience function keeps the word "blossom" explicit in the call site.
Definition at line 466 of file Blossom.H.
Referenced by TYPED_TEST().
| Blossom_Weighted_Result< long long > Aleph::blossom_maximum_weight_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Weight | weight = Weight(), |
||
| SA | sa = SA(), |
||
| const bool | max_cardinality = false |
||
| ) |
Alias for compute_maximum_weight_general_matching().
| [in] | g | Graph (must be undirected). |
| [out] | matching | Output list where the selected matching arcs will be stored. |
| [in] | weight | Weight accessor functor. Defaults to Dft_Dist<GT>. |
| [in] | sa | Arc filter for graph traversal. |
| [in] | max_cardinality | If true, optimize lexicographically: maximum cardinality first, then maximum weight. |
| domain_error | If `g` is a digraph. |
| overflow_error | If weights exceed `long long` limits or the number of nodes exceeds the internal solver's limit. |
Definition at line 374 of file Blossom_Weighted.H.
Referenced by TEST(), and TYPED_TEST().
| Min_Cost_Matching_Result< long long > Aleph::blossom_minimum_cost_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Cost | cost = Cost(), |
||
| SA | sa = SA(), |
||
| const bool | max_cardinality = false |
||
| ) |
Alias for compute_minimum_cost_general_matching().
Keeps the explicit blossom naming at call sites.
Definition at line 285 of file Min_Cost_Matching.H.
| Min_Cost_Perfect_Matching_Result< long long > Aleph::blossom_minimum_cost_perfect_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Cost | cost = Cost(), |
||
| SA | sa = SA() |
||
| ) |
Alias for compute_minimum_cost_perfect_general_matching().
Keeps the explicit blossom naming at call sites.
Definition at line 362 of file Min_Cost_Matching.H.
|
inline |
Breadth-first traversal starting from a given node.
Traverses the connected component reachable from start in breadth-first order.
The callback must have the following signature: bool visit(const GT& g, typename GT::Node* curr, typename GT::Arc* from).
from is the arc that discovered curr (nullptr for the start node). If visit returns true, the traversal stops early. If visit is nullptr, no callback is executed.
| GT | Graph type. |
| [in] | g | Graph to traverse. |
| [in] | start | Starting node (must be non-null and belong to g). |
| [in] | visit | Optional visit callback (may be nullptr). |
Breadth_First control bit on all nodes and arcs. Breadth_First control bit on both nodes and arcs.Definition at line 405 of file tpl_graph_utils.H.
References Aleph::and, ARC_BITS, Aleph::Breadth_First, Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), IS_ARC_VISITED, Aleph::DynListQueue< T >::is_empty(), IS_NODE_VISITED, NODE_BITS, Aleph::DynListQueue< T >::put(), GraphCommon< GT, Node, Arc >::reset_bit_arcs(), and GraphCommon< GT, Node, Arc >::reset_bit_nodes().
Referenced by Aleph::breadth_first_traversal(), TEST(), TEST(), and TEST().
| Df_Low_Tree_Node * Aleph::build_df_low_tree | ( | const GT & | g, |
| typename GT::Node * | src, | ||
| DynList< Df_Low_Non_Tree_Arc > & | non_tree_arcs, | ||
| Node_Label | node_label = Node_Label(), |
||
| SA | sa = SA() |
||
| ) |
Build the depth-first spanning tree of an undirected graph, with the df and low numbers of its nodes.
Traverses in depth first the nodes of g that src reaches, through the arcs that sa accepts, and returns their tree: the children of a node are in the order in which the traversal discovered them. Each node of the tree has the label of its graph node and its df and low numbers, as Compute_Cut_Nodes computes them (see generate_df_tree.H).
non_tree_arcs receives, in the order in which the traversal finds them, the other arcs between the nodes that src reaches, but for the arcs from a node to itself: for each one, the tree nodes of its descendant end and of its ancestor end.
| GT | Graph type; it must not be a digraph |
| Node_Label | Functor with std::string operator () (typename GT::Node *) that gives the label of each node |
| SA | Arc filter |
| [in] | g | The graph |
| [in] | src | The start node, the root of the tree |
| [out] | non_tree_arcs | The arcs that are not in the tree; it is emptied first |
| [in] | node_label | Label of each node |
| [in] | sa | Arc filter |
| std::domain_error | if g is a digraph |
| std::invalid_argument | if src is null |
| std::bad_alloc | if there is not enough memory |
On an exception, nothing is left allocated and non_tree_arcs is empty.
src reaches. The traversal does not recurse, so that the tree can be as deep as the graph has nodes. Definition at line 447 of file generate_df_tree.H.
References ah_domain_error_if, ah_invalid_argument_if, Aleph::df_tree_detail::Df_Low_Builder< GT, Node_Label, SA >::build(), Aleph::DynList< T >::empty(), and GraphCommon< GT, Node, Arc >::is_digraph().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and Aleph::write_df_low_tree().
| void Aleph::build_dominator_tree | ( | GT & | g, |
| typename GT::Node * | root, | ||
| GT & | tree, | ||
| SA | sa = SA() |
||
| ) |
Build the dominator tree of a digraph.
Convenience free function wrapping Lengauer_Tarjan_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. | |
| root | Root node. | |
| [out] | tree | Output dominator tree (cleared first). Nodes are mapped to the original graph via GT::map_nodes. |
| sa | Arc filter. |
Definition at line 678 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Dominators< GT, SA >::build_tree(), and root().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().
| DGT Aleph::build_planar_dual_graph | ( | const Planar_Dual_Metadata< GT > & | md | ) |
Build an Aleph dual graph from face/dual metadata.
Definition at line 3180 of file Planarity_Test.H.
References ah_runtime_error_unless, Aleph::Array< T >::append(), Aleph::Planar_Dual_Metadata< GT >::dual_edges, Aleph::Planar_Dual_Metadata< GT >::has_embedding, Aleph::Planar_Dual_Metadata< GT >::num_faces_local, and Aleph::Array< T >::reserve().
| DGT Aleph::build_planar_dual_graph | ( | const Planarity_Test_Result< GT > & | result | ) |
Build an Aleph dual graph directly from a planarity result.
Definition at line 3206 of file Planarity_Test.H.
References Aleph::planar_dual_metadata().
| void Aleph::build_post_dominator_tree | ( | const GT & | g, |
| typename GT::Node * | exit_node, | ||
| GT & | tree, | ||
| SA | sa = SA() |
||
| ) |
Build the post-dominator tree of a digraph.
Convenience free function wrapping Lengauer_Tarjan_Post_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. | |
| exit_node | Exit node. | |
| [out] | tree | Output post-dominator tree (cleared first). Nodes are mapped to the original graph via GT::map_nodes. |
| sa | Arc filter. |
Definition at line 1091 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::build_tree().
Referenced by TEST(), and TYPED_TEST().
| GT Aleph::build_spanning_tree | ( | const DynArray< typename GT::Arc * > & | arcs | ) |
Build a graph from a list of arcs (typically a spanning tree).
Builds a new graph ret containing every arc in arcs (skipping null entries). Nodes are created on demand.
Mapping:
ret stores the original node pointer in its cookie.ret stores the original arc pointer in its cookie.ret → original). The original graph is not modified.| [in] | arcs | Dynamic array containing the arcs to insert. |
arcs. | bad_alloc | If there is not enough memory. |
Definition at line 1543 of file tpl_graph_utils.H.
References ARC_COOKIE, arcs, FunctionalMethods< Container, T >::for_each(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), NODE_COOKIE, and Aleph::DynMapTree< Key, Data, Tree, Compare >::search().
Referenced by Aleph::Network_Simplex< Net >::run().
|
inline |
Forward declaration for build_subgraph().
Build a mapped subgraph from a starting node.
Traverses g in depth-first order starting at g_src, copying every reachable node and arc into sg.
node_count accumulates the number of visited nodes across repeated calls (useful when building all components).
Build_Subtree control bit on both nodes and arcs. g and sg.| [in] | g | Original graph. |
| [out] | sg | Destination graph (expected to be initially empty). |
| [in] | g_src | Starting node in g (must be non-null and belong to g). |
| [in,out] | node_count | Visited node counter. |
| bad_alloc | If there is not enough memory. |
Definition at line 1164 of file tpl_graph_utils.H.
References ALEPH_FLATTEN, ARC_BITS, Aleph::Build_Subtree, Aleph::count(), GraphCommon< GT, Node, Arc >::get_arc_it(), GTNodeCommon< NodeInfo >::get_info(), GTArcCommon< ArcInfo >::get_info(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), IS_ARC_VISITED, Aleph::Dfs_Stack< T >::is_empty(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), NODE_BITS, Aleph::Dfs_Stack< T >::pop(), Aleph::Dfs_Stack< T >::push(), and Aleph::Dfs_Stack< T >::top().
Referenced by Aleph::inconnected_components(), and TEST().
| size_t Aleph::chromatic_number | ( | const GT & | g, |
| DynMapTree< typename GT::Node *, size_t > & | colors, | ||
| SA | sa = SA() |
||
| ) |
Computes the exact chromatic number of a small graph.
Uses DSatur to obtain an upper bound, then performs binary search with backtracking to find the minimum \(k\)for which a valid \(k\)-coloring exists. Applicable only to graphs with at most 64 nodes.
| GT | Graph type (List_Graph, List_Digraph, Array_Graph, …). |
| SA | Arc-filter functor (defaults to Dft_Show_Arc<GT>). |
| [in] | g | Input graph. Must have at most 64 nodes and no self-loops. |
| [out] | colors | Output map from GT::Node* to 0-based color index for an optimal coloring. Cleared and overwritten on entry. |
| [in] | sa | The filter of the arcs, which each pass copies. |
| std::domain_error | if g has more than 64 nodes or contains a self-loop. |
g.get_num_nodes() <= 64 and no self-loops in g.NODE_COOKIE on every node; saved and restored via Cookie_Saver before the function returns.Definition at line 518 of file Graph_Coloring.H.
References ah_domain_error_if, Aleph::and, Aleph::DynList< T >::append(), GraphCommon< GT, Node, Arc >::get_arc_it(), LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), k, NODE_COOKIE, nodes, and Aleph::DynList< T >::size().
Referenced by demo_algorithm_comparison(), demo_exam_scheduling(), demo_register_allocation(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
|
inline |
Clean a graph: all its nodes and arcs are removed and freed.
The arcs are removed first, so that the removal of a node does not allocate.
| [in] | g | the graph |
| anything | that the removal of an arc throws: that of Net_Graph puts the ends of the arc in its sets of sources and sinks, which may throw bad_alloc. Then the arcs removed are gone, and the graph keeps the others and all its nodes. |
Definition at line 4776 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::remove_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::remove_node().
Referenced by Aleph::Euclidian_Graph< __Euclidian_Node, __Euclidian_Arc >::~Euclidian_Graph(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::~List_Graph(), Aleph::Karger_Min_Cut< GT, SA >::build_kgraph(), Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::build_tree(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::build_tree(), Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::Find_Breadth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::build_tree(), Aleph::GraphCopyWithMapping< GT, Tree >::clear(), Aleph::IndexNode< GT, Compare, Tree, SN >::clear_graph(), Aleph::Net_Cap_Graph< NodeT, ArcT >::compute_aux_net(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::compute_min_paths_tree(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_partial_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::compute_partial_min_paths_tree(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_partial_path(), Aleph::Copy_Graph< GT, SN, SA >::copy(), Aleph::copy_graph(), Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::initialize_and_create_nodes(), Aleph::inter_copy_graph(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), Aleph::Compute_Cut_Nodes< GT, SA >::map_subgraph(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), Aleph::Build_Grid< GT, Operation_On_Node, Operation_On_Arc >::operator()(), Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), TEST(), TEST_F(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::compute_bipartite | ( | const GT & | g, |
| DynDlist< typename GT::Node * > & | l, | ||
| DynDlist< typename GT::Node * > & | r, | ||
| SA | sa = SA() |
||
| ) |
Computes the partition sets of a bipartite graph.
A graph is bipartite if it can be divided into two subsets l and r such that every node in l only has edges to nodes in r and vice versa.
compute_bipartite(g,l,r) takes a bipartite graph g and computes the bipartition sets named by parameters l and r, respectively. In a graph that is not connected, the first node of each component, in the order of the nodes of g, goes to l.
| [in] | g | the bipartite graph. |
| [out] | l | one partition set. |
| [out] | r | the other partition set. |
| [in] | sa | the filter of the arcs, which each iterator copies. |
| domain_error | if during computation it is determined that the graph is not bipartite. |
| bad_alloc | if there is not enough memory. |
Definition at line 103 of file tpl_bipartite.H.
References ah_domain_error_if, Aleph::Bp_Blue, Aleph::Bp_Red, Aleph::Bp_White, Aleph::DynDlist< T >::get(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Dlink::is_empty(), l, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::DynList< T >::put(), Aleph::DynDlist< T >::put(), r, GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
Referenced by demo_dating(), demo_definition(), demo_halls_theorem(), demo_matching(), demo_testing(), and TYPED_TEST().
| bool Aleph::compute_bipartite_all_components | ( | const GT & | g, |
| DynDlist< typename GT::Node * > & | l, | ||
| DynDlist< typename GT::Node * > & | r, | ||
| SA | sa = SA() |
||
| ) |
Computes the partition sets of a bipartite graph handling all connected components.
It runs a BFS from each node that is not colored yet, as compute_bipartite() does, but it tells whether the graph is bipartite instead of throwing.
| [in] | g | the graph to test. |
| [out] | l | one partition set (red nodes). |
| [out] | r | the other partition set (blue nodes). |
| [in] | sa | the filter of the arcs, which each iterator copies. |
Definition at line 380 of file tpl_bipartite.H.
References Aleph::DynList< T >::append(), Aleph::Bp_Blue, Aleph::Bp_Red, Aleph::Bp_White, Aleph::DynListQueue< T >::get(), Aleph::DynListQueue< T >::is_empty(), l, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::DynListQueue< T >::put(), r, GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
| DynList< typename GT::Node * > Aleph::compute_cut_nodes | ( | const GT & | g, |
| typename GT::Node * | start | ||
| ) |
Compute articulation points (cut vertices) of an undirected graph.
Uses a DFS-based algorithm (Tarjan-style) to compute the articulation points reachable from start.
Side effects:
g.reset_arcs().Depth_First and Cut control bits on nodes, and Depth_First on arcs.nullptr.start is analyzed.| [in] | g | Graph to analyze (must not be a digraph). |
| [in] | start | Starting node (must be non-null and belong to g). |
g). | domain_error | If g is a directed graph. |
| bad_alloc | If there is not enough memory. |
Definition at line 1705 of file tpl_graph_utils.H.
References Aleph::__compute_cut_nodes(), ah_domain_error_if, ah_invalid_argument_if, Aleph::and, Aleph::DynList< T >::append(), ARC_BITS, Aleph::Cut, Aleph::Depth_First, GraphCommon< GT, Node, Arc >::for_each_node(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), IS_ARC_VISITED, GraphCommon< GT, Node, Arc >::is_digraph(), IS_NODE_VISITED, NODE_BITS, NODE_COOKIE, NODE_COUNTER, and GraphCommon< GT, Node, Arc >::reset_arcs().
Referenced by Aleph::compute_cut_nodes(), demo_bridges(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > Aleph::compute_dominance_frontiers | ( | GT & | g, |
| typename GT::Node * | root, | ||
| SA | sa = SA() |
||
| ) |
Compute dominance frontiers of a digraph.
Convenience free function wrapping Lengauer_Tarjan_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. |
| root | Root node. |
| sa | Arc filter. |
Definition at line 700 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dominance_frontiers(), and root().
Referenced by TEST(), TEST(), and TYPED_TEST().
| DynList< std::pair< typename GT::Node *, typename GT::Node * > > Aleph::compute_dominators | ( | GT & | g, |
| typename GT::Node * | root, | ||
| SA | sa = SA() |
||
| ) |
Compute immediate dominators of a digraph from a root node.
Convenience free function wrapping Lengauer_Tarjan_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. |
| root | Root node. |
| sa | Arc filter. |
Definition at line 657 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Dominators< GT, SA >::compute_idom(), and root().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| void Aleph::compute_maximum_cardinality_bipartite_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| SA | sa = SA() |
||
| ) |
Computes the maximum cardinality matching of a bipartite graph.
compute_maximum_cardinality_bipartite_matching(g,matching) takes a bipartite graph g and computes the maximum bipartite matching in the list matching.
The procedure computes the bipartition sets, then constructs an equivalent unit-capacity flow network and invokes a maximum flow algorithm on it. The graph need not be connected. The network has an integer flow, which is exact, and on which Ford-Fulkerson takes the paths of a depth-first search: with a floating flow it takes the shortest ones, some 3.5 times slower on this network.
The routine handles two type parameters:
| [in] | g | the bipartite graph. |
| [out] | matching | list of arcs that form the matching. |
| [in] | sa | the filter of the arcs, which each iterator copies. |
| bad_alloc | if there is not enough memory. |
Definition at line 233 of file tpl_bipartite.H.
References Aleph::DynDlist< T >::append(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::has_curr(), Aleph::Dlink::Iterator::has_curr(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), l, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, r, and Aleph::DynMapTree< Key, Data, Tree, Compare >::search().
Referenced by TYPED_TEST().
| size_t Aleph::compute_maximum_cardinality_general_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| SA | sa = SA() |
||
| ) |
Computes a maximum cardinality matching in a general graph.
Applies Edmonds' Blossom algorithm to an undirected graph. The resulting matching arcs are stored in the provided list.
| GT | Graph type (e.g., List_Graph). |
| SA | Arc filter type (defaults to show all arcs). |
| [in] | g | The undirected graph to process. |
| [out] | matching | A list where the arcs of the maximum matching will be stored. |
| [in] | sa | An optional arc filter instance. |
| ah_domain_error | if g is a directed graph (digraph). |
| ah_bad_alloc | if memory allocation for internal structures fails. |
Definition at line 433 of file Blossom.H.
References ah_domain_error_if, ah_runtime_error_unless, Aleph::and, Aleph::DynDlist< T >::append(), Aleph::DynDlist< T >::empty(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::get_match_vector(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::get_pair_arc(), GraphCommon< GT, Node, Arc >::is_digraph(), and Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::solve().
| Blossom_Weighted_Result< long long > Aleph::compute_maximum_weight_general_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Weight | weight = Weight(), |
||
| SA | sa = SA(), |
||
| const bool | max_cardinality = false |
||
| ) |
Compute maximum-weight matching in a general undirected graph.
Finds a matching with the highest possible sum of edge weights. If max_cardinality is true, it finds a matching that first maximizes the number of edges, and among those, maximizes the total weight.
| GT | Aleph undirected graph type (List_Graph, List_SGraph, Array_Graph). |
| Weight | Weight accessor functor (must return an integral type). |
| SA | Arc filter. |
| [in] | g | Graph (must be undirected). |
| [out] | matching | Output list where the selected matching arcs will be stored. |
| [in] | weight | Weight accessor functor. Defaults to Dft_Dist<GT>. |
| [in] | sa | Arc filter for graph traversal. |
| [in] | max_cardinality | If true, optimize lexicographically: maximum cardinality first, then maximum weight. |
| domain_error | If `g` is a digraph. |
| overflow_error | If weights exceed `long long` limits or the number of nodes exceeds the internal solver's limit. |
Definition at line 178 of file Blossom_Weighted.H.
References Aleph::blossom_weighted_detail::mwmatching::adjust_weights_for_maximum_cardinality_matching(), ah_domain_error_if, ah_overflow_error_if, ah_runtime_error_unless, Aleph::and, Aleph::Array< T >::append(), Aleph::DynDlist< T >::append(), Aleph::DynDlist< T >::empty(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::in_place_sort(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Array< T >::is_empty(), Aleph::blossom_weighted_detail::mwmatching::maximum_weight_matching(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, num_nodes, Aleph::Array< T >::reserve(), Aleph::Array< T >::size(), Aleph::sum(), Aleph::blossom_weighted_detail::to_ll_checked(), and w.
Referenced by TYPED_TEST(), and TYPED_TEST().
| long Aleph::compute_min_cut | ( | GT & | g, |
| DynSetTree< typename GT::Node * > & | l, | ||
| DynSetTree< typename GT::Node * > & | r, | ||
| DynDlist< typename GT::Arc * > & | cut, | ||
| SA | sa = SA() |
||
| ) |
Compute a minimum edge cut of an undirected graph.
Builds a unit-capacity auxiliary network and uses successive max-flow computations to obtain a minimum cut. The partition and cut arcs are returned through output parameters.
The arc filter SA is applied when computing degrees, connectivity, and when building the auxiliary network.
Output parameters are cleared on entry.
cut is empty, and the partition l/r corresponds to the component reachable from a minimum-degree node. Side effects:
Depth_First control bit on nodes and arcs to test connectivity.| GT | Graph type (undirected). |
| Max_Flow | Maximum flow functor. |
| SA | Arc filter functor. |
| [in,out] | g | Graph to analyze. |
| [out] | l | Set of nodes on the source side of the cut. |
| [out] | r | Set of nodes on the sink side of the cut. |
| [out] | cut | List of cut arcs (arcs crossing between l and r). |
| [in] | sa | the filter of the arcs, which each iterator copies. |
g (minimum cut size). | std::domain_error | If g is a digraph. |
| std::bad_alloc | If there is not enough memory. |
Definition at line 266 of file tpl_kgraph.H.
References ah_domain_error_if, Aleph::DynList< T >::append(), Aleph::DynDlist< T >::append(), ARC_COOKIE, Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::Depth_First, Aleph::DynList< T >::empty(), Aleph::DynDlist< T >::empty(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Dlink::Iterator::has_curr(), Aleph::HTList::Iterator::has_curr(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::DynList< T >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), GraphCommon< GT, Node, Arc >::is_digraph(), IS_NODE_VISITED, l, GraphCommon< GT, Node, Arc >::map_nodes(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, num_nodes, r, Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::Net_Graph< NodeT, ArcT >::reset(), Aleph::DynList< T >::swap(), and Aleph::DynSetTree< Key, Tree, Compare >::swap().
| Min_Cost_Matching_Result< long long > Aleph::compute_minimum_cost_general_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Cost | cost = Cost(), |
||
| SA | sa = SA(), |
||
| const bool | max_cardinality = false |
||
| ) |
Compute minimum-cost matching in a general undirected graph.
Computes a matching that minimizes total cost. If max_cardinality is true, it first maximizes cardinality and then minimizes cost.
| GT | Aleph undirected graph type. |
| Cost | Cost accessor functor (must return integral type). |
| SA | Arc filter. |
| [in] | g | Graph (must be undirected). |
| [out] | matching | Output list with matching arcs. |
| [in] | cost | Cost accessor (defaults to Dft_Dist<GT>). |
| [in] | sa | Arc filter. |
| [in] | max_cardinality | If true, optimize lexicographically: maximum cardinality first, then minimum cost. |
Min_Cost_Matching_Result<long long> with total cost and cardinality.| domain_error | If `g` is a digraph. |
| overflow_error | If costs cannot be represented or summed in long long. |
Definition at line 227 of file Min_Cost_Matching.H.
References ah_domain_error_if, ah_overflow_error_if, ah_runtime_error_unless, Aleph::and, Aleph::Min_Cost_Matching_Result< Cost_Type >::cardinality, GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::sum(), and Aleph::min_cost_matching_detail::to_ll_checked().
Referenced by TYPED_TEST().
| Min_Cost_Perfect_Matching_Result< long long > Aleph::compute_minimum_cost_perfect_general_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| Cost | cost = Cost(), |
||
| SA | sa = SA() |
||
| ) |
Compute minimum-cost perfect matching in a general undirected graph.
This function searches for a perfect matching (all vertices matched) and minimizes total cost among perfect matchings.
Behavior:
feasible = true and fills matching with a minimum-cost perfect matching.feasible = false and leaves matching empty.| GT | Aleph undirected graph type. |
| Cost | Cost accessor functor (must return integral type). |
| SA | Arc filter. |
| [in] | g | Graph (must be undirected). |
| [out] | matching | Output list with matching arcs if feasible. |
| [in] | cost | Cost accessor (defaults to Dft_Dist<GT>). |
| [in] | sa | Arc filter. |
Min_Cost_Perfect_Matching_Result<long long>.| domain_error | If `g` is a digraph. |
| overflow_error | If costs cannot be represented or summed in long long. |
Definition at line 324 of file Min_Cost_Matching.H.
References ah_domain_error_if, Aleph::DynDlist< T >::empty(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), num_nodes, and Aleph::Min_Cost_Perfect_Matching_Result< Cost_Type >::total_cost.
Referenced by TYPED_TEST().
| DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > Aleph::compute_post_dominance_frontiers | ( | const GT & | g, |
| typename GT::Node * | exit_node, | ||
| SA | sa = SA() |
||
| ) |
Compute post-dominance frontiers of a digraph.
Convenience-free function wrapping Lengauer_Tarjan_Post_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. |
| exit_node | Exit node. |
| sa | Arc filter. |
Definition at line 1114 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::post_dominance_frontiers().
Referenced by TEST(), and TYPED_TEST().
| DynList< std::pair< typename GT::Node *, typename GT::Node * > > Aleph::compute_post_dominators | ( | const GT & | g, |
| typename GT::Node * | exit_node, | ||
| SA | sa = SA() |
||
| ) |
Compute immediate post-dominators of a digraph from an exit node.
Convenience free function wrapping Lengauer_Tarjan_Post_Dominators.
| GT | Graph type (must be directed). |
| SA | Arc filter type. |
| g | The directed graph. |
| exit_node | Exit node. |
| sa | Arc filter. |
Definition at line 1068 of file Dominators.H.
References Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::compute_ipdom().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
|
noexcept |
Strict read-only view of a graph.
| [in] | g | the graph; it must outlive the view. |
Const_Graph_View of g. Definition at line 999 of file tpl_const_graph_view.H.
Referenced by TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Explicit copy of graph.
This function takes a source graph gsrc for copying to another target graph gtgt. First the function cleans gtgt; that is all its arc and nodes are removed and freed. Then gsrc is copied to gtgt- The resulting gtgt is isomorphic to gsrc.
Eventually, the copy can be mapped through the cookies. For that, a forth bool parameter is specified-
| [in] | gsrc | source graph |
| [in] | gtgt | target graph |
| [in] | cookie_map | boolean indicating if the result must be mapped through the nodes and arcs cookies. |
| bad_alloc | if there is no enough memory. Then gtgt is empty: the copy assignments of the graphs, which copy to a new graph and swap, keep their contents instead. |
Definition at line 4794 of file tpl_graph.H.
References Aleph::clear_graph(), GraphCommon< GT, Node, Arc >::get_cookie(), GTNodeCommon< NodeInfo >::get_info(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::swap().
Referenced by Aleph::Net_Graph< NodeT, ArcT >::Net_Graph(), TEST(), TEST(), TEST_F(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Depth-first traversal starting from a given node.
Traverses in depth-first order, without recursion, the connected component reachable from start_node.
The callback must have the following signature: bool visit(const GT& g, typename GT::Node* curr, typename GT::Arc* from).
from is the arc that discovered curr (nullptr for the start node). If visit returns true, the traversal stops early. If visit is nullptr, no callback is executed.
| GT | Graph type. |
| [in] | g | Graph to traverse. |
| [in] | start_node | Starting node (must be non-null and belong to g). |
| [in] | visit | Optional visit callback (may be nullptr). |
Depth_First control bit on all nodes and arcs. Depth_First control bit on both nodes and arcs.Definition at line 114 of file tpl_graph_utils.H.
References Aleph::__depth_first_traversal(), counter, Aleph::Depth_First, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), and GraphCommon< GT, Node, Arc >::reset_bit_nodes().
Referenced by Aleph::depth_first_traversal(), TEST(), TEST(), and TEST().
The current item of an iterator that has one.
A search that knows that it has a current item asks for it with get_curr_ne(), which does not check that there is one, if it has it, or else with get_curr().
| it | Iterator positioned on an item. |
it. Definition at line 676 of file tpl_dfs_stack.H.
References Aleph::DynList< T >::Iterator::get_curr(), and Aleph::DynList< T >::Iterator::get_curr_ne().
Referenced by Aleph::Find_Path_Depth_First< GT, Itor, SA >::find_path(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::next_target(), and Aleph::Find_Path_Depth_First< GT, Itor, SA >::next_target().
The frame that a Dfs_Here holds.
| here | The optional frame, if frames cannot be assigned; it must hold one. |
Definition at line 630 of file tpl_dfs_stack.H.
The frame that a Dfs_Here holds.
| here | The frame, if frames can be assigned. |
Definition at line 617 of file tpl_dfs_stack.H.
Referenced by Aleph::Find_Path_Depth_First< GT, Itor, SA >::find_path(), Aleph::hopcroft_karp_dfs(), TEST(), and TEST().
Builds the variable of the frame of a search, with the frame built with args.
| T | Type of the frames. |
| args | Arguments for the constructor of the frame. |
Definition at line 602 of file tpl_dfs_stack.H.
|
inline |
Replaces the frame that a Dfs_Here holds with one built in its place with args.
| here | The optional frame, if frames cannot be assigned. |
| args | Arguments for the constructor of the frame. |
| anything | that the constructor of the frame throws; then here holds no frame. |
Definition at line 660 of file tpl_dfs_stack.H.
Replaces the frame that a Dfs_Here holds with one built with args, by assignment.
| here | The frame, if frames can be assigned. |
| args | Arguments for the constructor of the frame. |
| anything | that the constructor or the assignment of the frame throws; then here keeps its frame. |
Definition at line 645 of file tpl_dfs_stack.H.
Referenced by Aleph::Find_Path_Depth_First< GT, Itor, SA >::find_path(), Aleph::hopcroft_karp_dfs(), TEST(), and TEST().
| void Aleph::digraph_graphviz | ( | const GT & | g, |
| std::ostream & | out, | ||
| Node_Attr | node_attr = Node_Attr(), |
||
| Arc_Attr | arc_attr = Arc_Attr(), |
||
| const std::string & | rankdir = "LR", |
||
| SA | sa = SA() |
||
| ) |
Generate Graphviz DOT output specifically for digraphs.
Similar to generate_graphviz() but always outputs "digraph {}" regardless of the graph type. Useful when you want to force directed edge notation.
| GT | Graph type |
| Node_Attr | Node attribute generator |
| Arc_Attr | Arc attribute generator |
| SN | Node filter |
| SA | Arc filter |
| g | Graph to visualize |
| out | Output stream |
| node_attr | Node attribute functor |
| arc_attr | Arc attribute functor |
| rankdir | Layout direction (default: "LR" for left-to-right) |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 463 of file generate_graph.H.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and out.
| size_t Aleph::dsatur_coloring | ( | const GT & | g, |
| DynMapTree< typename GT::Node *, size_t > & | colors, | ||
| SA | sa = SA() |
||
| ) |
DSatur graph coloring (saturation-degree heuristic).
At each step the uncolored node with the highest saturation degree (number of distinct colors among already-colored neighbors) is colored first, using the smallest available color. Ties are broken by choosing the node with the highest degree. This adaptive strategy frequently produces near-optimal or optimal colorings.
| GT | Graph type (List_Graph, List_Digraph, Array_Graph, …). |
| SA | Arc-filter functor (defaults to Dft_Show_Arc<GT>). |
| [in] | g | Input graph. Must not contain self-loops. |
| [out] | colors | Output map from GT::Node* to 0-based color index. Cleared and overwritten on entry. |
| [in] | sa | The filter of the arcs, which each pass copies. |
| std::domain_error | if g contains a self-loop. |
g.NODE_COOKIE on every node; saved and restored via Cookie_Saver before the function returns.Definition at line 354 of file Graph_Coloring.H.
References Aleph::and, LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::is_empty(), NODE_COOKIE, Aleph::DynSetTree< Key, Tree, Compare >::remove(), Aleph::DynSetTree< Key, Tree, Compare >::size(), and w.
Referenced by demo_algorithm_comparison(), demo_cookie_safety(), demo_exam_scheduling(), demo_map_coloring(), demo_register_allocation(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| long Aleph::edge_connectivity | ( | GT & | g, |
| SA | sa = SA() |
||
| ) |
Compute edge connectivity (arc connectivity) of an undirected graph.
Builds a unit-capacity auxiliary network and computes maximum flow from a fixed source to every other node. The minimum of those flow values equals the edge connectivity.
The arc filter SA is applied when computing degrees and when building the auxiliary network.
| GT | Graph type (undirected). |
| Max_Flow | Maximum flow functor to use. |
| SA | Arc filter functor. |
Side effects:
Depth_First control bit on nodes and arcs to test connectivity.| [in,out] | g | Graph to analyze. |
| [in] | sa | the filter of the arcs, which each iterator copies. |
g (0 for empty or disconnected graphs). | std::domain_error | If g is a digraph. |
| std::bad_alloc | If there is not enough memory. |
Definition at line 113 of file tpl_kgraph.H.
References ah_domain_error_if, Aleph::DynDlist< T >::append(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Dlink::Iterator::has_curr(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, num_nodes, Aleph::Net_Graph< NodeT, ArcT >::remove_node(), and Aleph::Net_Graph< NodeT, ArcT >::reset().
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > Aleph::eppstein_k_shortest_paths | ( | const GT & | g, |
| typename GT::Node * | source, | ||
| typename GT::Node * | target, | ||
| const size_t | k, | ||
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Compute k shortest general (loopy) paths.
Returns up to k paths (allowing cycles) ordered by non-decreasing total cost. If fewer than k paths exist, all available paths are returned. A path may go through target before it ends there.
This algorithm uses an Eppstein-style approach: it builds a shortest path tree towards the target in the reversed graph, then explores path deviations ordered by cost.
| GT | Graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter. |
| [in] | g | Graph. |
| [in] | source | Source node. |
| [in] | target | Target node. |
| [in] | k | Maximum number of paths to return. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
DynList<K_Shortest_Path_Item<GT, Cost_Type>> containing the paths found.| std::domain_error | If source or target is null. |
| std::domain_error | If negative arc weights are detected. |
| std::overflow_error | If the cost of one of the first k walks does not fit in Distance_Type. A walk beyond the first k whose cost does not fit throws nothing, and so a node whose distance to target does not fit, if no walk that is asked goes through it. |
source and target are the same node the function returns exactly one result — the trivial zero-cost path — regardless of k. Loopy cycles through source are not enumerated because generate_general_deviation_candidates exits immediately on an empty-arc base path. If cycle enumeration from a self-loop origin is required, call the function with a distinct dummy source or implement a dedicated cycle-seeding pass. Definition at line 1172 of file K_Shortest_Paths.H.
References ah_domain_error_if, ah_overflow_error_if, Aleph::and, Aleph::Array< T >::append(), Aleph::DynList< T >::append(), Aleph::k_shortest_paths_detail::contains_path(), Aleph::Array< T >::get_last(), Aleph::Array< T >::is_empty(), k, Aleph::Array< T >::remove_last(), Aleph::Array< T >::reserve(), Aleph::Array< T >::size(), Aleph::k_shortest_paths_detail::state_to_path(), and Aleph::k_shortest_paths_detail::validate_non_negative_weights().
Referenced by TEST().
|
inline |
Build a breadth-first spanning tree (mapped to the original graph).
Returns a spanning tree of the connected component reachable from gp, visiting nodes in breadth-first order.
Side effects:
Spanning_Tree control bit on all nodes and arcs.Spanning_Tree control bit on both nodes and arcs.g and the returned tree via cookies.| [in,out] | g | Graph to traverse. |
| [in] | gp | Start node (must be non-null and belong to g). |
| bad_alloc | If there is not enough memory. |
Definition at line 1461 of file tpl_graph_utils.H.
References Aleph::and, ARC_BITS, ARC_COOKIE, Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), IS_ARC_VISITED, Aleph::DynListQueue< T >::is_empty(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), NODE_BITS, NODE_COOKIE, Aleph::DynListQueue< T >::put(), GraphCommon< GT, Node, Arc >::reset_bit_arcs(), GraphCommon< GT, Node, Arc >::reset_bit_nodes(), and Aleph::Spanning_Tree.
Referenced by TEST(), TEST(), and TYPED_TEST().
| DynList< typename GT::Arc * > Aleph::find_bridges | ( | const GT & | g, |
| typename GT::Node * | start, | ||
| SA | sa = SA() |
||
| ) |
Find all bridge edges in a connected undirected graph.
Convenience free function wrapping Compute_Bridges<GT, SA>. A bridge is an arc whose removal disconnects the graph.
| GT | Graph type. |
| SA | Arc filter. |
| [in] | g | Undirected connected graph. |
| [in] | start | Starting node for the DFS. |
| [in] | sa | Arc filter. |
DynList of pointers to bridge arcs.Definition at line 1087 of file tpl_cut_nodes.H.
References Aleph::Compute_Bridges< GT, SA >::find_bridges().
Referenced by demo_bridges(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Build a depth-first spanning tree (mapped to the original graph).
Returns a spanning tree of the connected component reachable from gnode, visiting nodes in depth-first order.
Side effects:
g.reset_nodes() and g.reset_arcs().Spanning_Tree control bit on both nodes and arcs.g and the returned tree via cookies.| [in] | g | Graph to traverse. |
| [in] | gnode | Start node (must be non-null and belong to g). |
| bad_alloc | If there is not enough memory. |
Definition at line 1296 of file tpl_graph_utils.H.
References Aleph::__find_depth_first_spanning_tree(), GraphCommon< GT, Node, Arc >::get_arc_it(), GTNodeCommon< NodeInfo >::get_info(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), IS_ARC_VISITED, IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_nodes(), NODE_BITS, GraphCommon< GT, Node, Arc >::reset_arcs(), GraphCommon< GT, Node, Arc >::reset_nodes(), GraphCommon< GT, Node, Arc >::set_bit(), and Aleph::Spanning_Tree.
Referenced by Aleph::find_depth_first_spanning_tree(), TEST(), and TEST().
| DynList< Negative_Cycle_Item< GT, typename Distance::Distance_Type > > Aleph::find_disjoint_negative_cycles | ( | const GT & | g, |
| const size_t | max_cycles, | ||
| const Negative_Cycle_Exclusion | exclusion = Negative_Cycle_Exclusion::Min_Weight_Arc, |
||
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Find up to max_cycles negative cycles, excluding arcs of each cycle found before searching for the next one.
Each round is a Bellman-Ford relaxation over the arcs not yet excluded, started from a virtual source (every node at distance zero, so cycles reachable from anywhere are found). After every pass the predecessor graph (at most one arc per node) is scanned in O(V) for a cycle; any such cycle is a negative cycle, so the certificate is found as soon as it appears — typically after a few passes — instead of waiting for the classical criterion of a relaxation in the n-th pass. The cycle is extracted, reported with its exact arcs and total cost, and its arcs are excluded according to exclusion. The search stops when max_cycles cycles have been reported or a pass relaxes nothing (no negative cycle is left among the remaining arcs).
This is a greedy enumeration, not an exhaustive one (listing all negative cycles is exponential in general). What it guarantees:
Negative_Cycle_Exclusion::All_Arcs they are pairwise arc-disjoint;sa, the first round finds one, provided the arithmetic is exact (integer costs). With floating-point costs a huge partial distance can absorb a small negative weight and hide the cycle (see the numeric model in the file documentation);What it does not guarantee: that the reported cycles are the most negative ones, or that after excluding an arc no negative cycle through the other arcs of the reported cycle is missed (Negative_Cycle_Exclusion::Min_Weight_Arc keeps them findable, All_Arcs deliberately does not).
| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter; arcs it rejects do not exist for the search. |
| [in] | g | Graph (must be directed). It is not modified. |
| [in] | max_cycles | Maximum number of cycles to report; 0 returns an empty list without touching the graph. |
| [in] | exclusion | Which arcs of each found cycle are excluded. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
g.| std::domain_error | If g is undirected or a floating weight (or an accumulated sum) is not finite. |
| std::overflow_error | If integer additions overflow. |
R <= E + 1 is the number of rounds (at most max_cycles + 1 unless floating-point candidates are discarded without being reported); the per-pass cycle check adds O(V) to the O(E) pass. O(V + E) working space, not counting the returned paths. In practice each round stops at the first pass whose predecessor graph contains a cycle, usually far earlier than pass V. Definition at line 1269 of file Negative_Cycles.H.
References Aleph::All_Arcs, Aleph::and, Aleph::Array< T >::append(), Aleph::DynList< T >::append(), graph_harness::Spec::arcs, Aleph::negative_cycles_detail::check_finite(), Aleph::shortest_path_detail::checked_add(), Aleph::negative_cycles_detail::cycle_cost(), Aleph::Array< T >::empty(), Aleph::negative_cycles_detail::find_predecessor_cycle(), Aleph::negative_cycles_detail::index_graph(), m, Aleph::none(), pred, OhashCommon< HashTbl, Key >::size(), and y.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::find_min_path | ( | Mat & | p, |
| long | src_idx, | ||
| long | tgt_idx, | ||
| Path< typename Mat::Graph_Type > & | path | ||
| ) |
Build a minimum path from Floyd-Warshall path matrix using indices.
Takes a path matrix computed by Floyd-Warshall algorithm and two matrix indices (source and target), then constructs the minimum path in the adjacency list representation.
The path is reconstructed by following the intermediate node indices stored in the path matrix until reaching the target.
| Mat | Matrix type from Map_Matrix_Graph (e.g., Ady_Mat<GT, long, ...>) |
| Compare | Comparison of the weights of the arcs, that of the floyd_all_shortest_paths() that computed p (default: std::less<>, which gives the order of operator <, as the default comparison of floyd_all_shortest_paths() does) |
| [in] | p | Path index matrix from Floyd-Warshall. Entry p(i,j) contains the index of the next node after i on the shortest path to j. |
| [in] | src_idx | Source node index in the path matrix (0-based). |
| [in] | tgt_idx | Target node index in the path matrix (0-based). |
| [out] | path | The reconstructed minimum path in the adjacency list graph. The path is cleared and rebuilt from scratch. |
Between two consecutive nodes, if the arcs give their weights by get_info().get_distance(), the path takes the lightest of the parallel arcs, by Compare: with the comparison that floyd_all_shortest_paths() used, the arc that the distance counts. Otherwise, it takes the first arc that it finds.
p must have been computed by floyd_all_shortest_paths(). src_idx and tgt_idx must be valid indices (0 <= idx < n). src_idx and tgt_idx (no infinite distance).| std::bad_alloc | If insufficient memory to build the path. |
| std::invalid_argument | If two consecutive nodes of the path have no arc between them, which the matrix of floyd_all_shortest_paths() does not give. |
Definition at line 191 of file mat_path.H.
References Aleph::find_min_path(), and Aleph::Path< GT >::set_graph().
Referenced by Aleph::find_min_path(), Aleph::find_min_path(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::find_min_path | ( | Mat & | p, |
| typename Mat::Node * | src_node, | ||
| typename Mat::Node * | tgt_node, | ||
| Path< typename Mat::Graph_Type > & | path | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Build a minimum path using node pointers instead of indices.
Convenience overload that accepts node pointers and converts them to matrix indices before calling the index-based version.
Definition at line 228 of file mat_path.H.
References Aleph::find_min_path().
|
inline |
Breadth-first search of a (shortest-by-edges) path between two nodes.
Searches a path from start to end using breadth-first search (BFS). If a path exists, the returned path has the minimum number of arcs (ties depend on iteration order).
Side effects:
g.reset_nodes() and g.reset_arcs().Find_Path control bit on nodes and arcs.| GT | Graph type. |
| [in] | g | Graph to search. |
| [in] | start | Start node (must be non-null and belong to g). |
| [in] | end | End node (must be non-null and belong to g). |
Path<GT> describing the found path; an empty path if no path exists. | bad_alloc | If there is not enough memory. |
Definition at line 633 of file tpl_graph_utils.H.
References ah_invalid_argument_if, Aleph::and, ARC_BITS, Aleph::DynListQueue< T >::empty(), Aleph::Find_Path, Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Path< GT >::insert(), IS_ARC_VISITED, Aleph::DynListQueue< T >::is_empty(), IS_NODE_VISITED, NODE_BITS, NODE_COOKIE, Aleph::DynListQueue< T >::put(), GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
|
inline |
Depth-first search of a path between two nodes.
find_path_depth_first() searches depth-first a path between start_node and end_node, without recursion: the path can be as long as the graph.
| [in] | g | the graph |
| [in] | start_node | pointer to the starting node of search |
| [in] | end_node | pointer to ending node of search |
Path object containing the path if this was found; an empty path otherwise | bad_alloc | if there is no enough memory |
Definition at line 4695 of file tpl_graph.H.
References ARC_BITS, Aleph::Path< GT >::empty(), Aleph::Find_Path, GraphCommon< GT, Node, Arc >::get_arc_it(), IS_NODE_VISITED, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_BITS, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), and GraphCommon< GT, Node, Arc >::reset_bit_nodes().
| void Aleph::floyd_all_shortest_paths | ( | GT & | g, |
| Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > & | dist, | ||
| Ady_Mat< GT, long > & | path | ||
| ) |
Compute all-pairs shortest paths using Floyd-Warshall algorithm.
Computes the shortest path between every pair of vertices in the graph. The algorithm runs in O(V³) time and O(V²) space.
| GT | Graph type (must have Arc_Type with Distance_Type, Max_Distance, Zero_Distance) |
| Compare | Comparison functor (default: less) |
| Plus | Addition functor for distances (default: plus) |
| g | The input graph | |
| [out] | dist | Distance matrix - dist(i,j) = shortest distance from i to j |
| [out] | path | Path matrix - path(i,j) = next node on shortest path from i to j |
Of the parallel arcs between two nodes, the lightest counts, by Compare; a loop does not count. The matrices start as Initialize_Dist sets them.
| std::bad_alloc | if there is not enough memory. |
Definition at line 256 of file latex_floyd.H.
References GraphCommon< GT, Node, Arc >::get_num_nodes(), max(), and Aleph::Plus.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::floyd_all_shortest_paths_latex | ( | GT & | g, |
| Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > & | dist, | ||
| Ady_Mat< GT, long > & | path, | ||
| std::ofstream & | output | ||
| ) |
Floyd-Warshall algorithm with LaTeX step-by-step output.
Computes all-pairs shortest paths while generating LaTeX output showing the distance and path matrices at each iteration step. Useful for educational purposes and algorithm visualization.
Generates figures with side-by-side D_k and P_k matrices for k = 0..n. Requires LaTeX packages: float (for [H] placement).
| GT | Graph type |
| Compare | Comparison functor |
| Plus | Addition functor |
| P_i | Row/column index formatter |
| P_ij | Path matrix entry formatter |
| D_ij | Distance matrix entry formatter |
| g | The input graph | |
| [out] | dist | Distance matrix |
| [out] | path | Path matrix |
| [out] | output | Output stream for LaTeX code |
It counts the arcs as floyd_all_shortest_paths() does: of the parallel arcs between two nodes, the lightest, by Compare, and no loop.
| std::bad_alloc | if there is not enough memory. |
Definition at line 337 of file latex_floyd.H.
References GraphCommon< GT, Node, Arc >::get_num_nodes(), max(), output, and Aleph::Plus.
Referenced by TEST_F(), TEST_F(), TEST_F(), and TYPED_TEST().
| T Aleph::foldl_arcs | ( | GT & | g, |
| const T & | init, | ||
| Op | operation, | ||
| SA | sa = SA() |
||
| ) |
Fold the filtered arcs of a graph.
| [in] | g | the graph |
| [in] | init | initial value of folded result |
| [in] | operation | folding operation on the arc |
| [in] | sa | arc filter |
Definition at line 1634 of file tpl_graph.H.
References Aleph::init.
| T Aleph::foldl_arcs | ( | GT & | g, |
| typename GT::Node * | p, | ||
| const T & | init, | ||
| Op | operation, | ||
| SA | sa = SA() |
||
| ) |
Fold the filtered adjacent arcs of a node.
| [in] | g | the graph |
| [in] | p | node pointer |
| [in] | init | initial value of folded result |
| [in] | operation | folding operation on the arc |
| [in] | sa | arc filter |
Definition at line 1658 of file tpl_graph.H.
References Aleph::init.
| T Aleph::foldl_nodes | ( | GT & | g, |
| const T & | init, | ||
| Op | operation, | ||
| SN | sn = SN() |
||
| ) |
Fold the filtered nodes of a graph.
| [in] | g | the graph |
| [in] | init | initial value of folded result |
| [in] | operation | folding operation on the node |
| [in] | sn | node filter |
Definition at line 1611 of file tpl_graph.H.
References Aleph::init.
| void Aleph::for_each_arc | ( | const GT & | g, |
| Op | operation, | ||
| SA | sa = SA() |
||
| ) |
Traverse all the arcs of graph filtering some ones according to a condition and executing an operation on them.
| [in] | g | the graph |
| [in] | operation | to be executed on each seen arc |
| [in] | sa | an arc filter |
Definition at line 1339 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::for_each_arc | ( | const GT & | g, |
| typename GT::Node * | p, | ||
| Op | operation, | ||
| SA | sa = SA() |
||
| ) |
Traverse all the arcs adjacent to a node filtering some ones according to a condition and executing an operation on them.
| [in] | g | the graph |
| [in] | p | a node pointer |
| [in] | operation | to be executed on each seen arc |
| [in] | sa | an arc filter |
Definition at line 1359 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
|
inline |
Execute an operation on each arc of a node.
This template function receives threes template parameters:
GT: the graph type.Itor: the iterator type; it is intended to be _In_Iterator or _Out_Iterator.Operation: an operation to be executed on each arc. This operation must have the following signature:void operation(typename GT::Arc * arc)
| [in] | p | node pointer |
| [in] | op | operation to be performed on each arc |
Definition at line 2918 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
|
inline |
Executes an operation on each arc of g into p: on a digraph, which the function tells at run time, among the arcs of the graph, in \(O(E)\).
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | op | operation to perform on each arc |
Definition at line 3008 of file tpl_graph.H.
References Aleph::all(), and Aleph::in_arcs_detail::traverse_arcs_into().
|
inline |
Traverse the incoming arcs of a node and executes an operation.
It does not compile on a digraph type: use for_each_in_arc(g, p, op).
| [in] | p | node pointer |
| [in] | op | operation to perform on each node |
Definition at line 2989 of file tpl_graph.H.
Referenced by Aleph::filter_in_arcs(), Aleph::foldl_in_arcs(), Aleph::map_in_arcs(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::for_each_node | ( | const GT & | g, |
| Op | operation, | ||
| SN | sn = SN() |
||
| ) |
Traverse all the nodes of graph filtering some ones according to a condition and executing an operation on them.
| [in] | g | the graph |
| [in] | operation | to be executed on each seen node |
| [in] | sn | a node filter |
Definition at line 1320 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TYPED_TEST().
|
inline |
Traverse the outcoming arcs of a node and executes an operation.
| [in] | p | node pointer |
| [in] | op | operation to perform on each node |
Definition at line 3386 of file tpl_graph.H.
| bool Aleph::forall_arc | ( | const GT & | g, |
| Op | cond, | ||
| SA | sa = SA() |
||
| ) |
Return true if condition cond is met on every filtered arc of the graph.
| [in] | g | the graph |
| [in] | cond | condition |
| [in] | sa | arc filter |
true if all the arcs satisfy the condition; false otherwise Definition at line 1403 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TEST(), TYPED_TEST(), and TYPED_TEST().
| bool Aleph::forall_arc | ( | typename GT::Node * | p, |
| Op | cond, | ||
| SA | sa = SA() |
||
| ) |
Return true if the condition cond is met on every filtered arc of a node.
| [in] | p | node pointer |
| [in] | cond | condition |
| [in] | sa | arc filter |
true if all the arcs satisfy the condition; false otherwise Definition at line 1425 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| bool Aleph::forall_node | ( | const GT & | g, |
| Op | cond, | ||
| SN | sn = SN() |
||
| ) |
Return true if condition cond is met on every filtered node of the graph.
| [in] | g | the graph |
| [in] | cond | condition |
| [in] | sn | node filter |
true if all the nodes satisfy the condition; false otherwise Definition at line 1381 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TYPED_TEST().
| void Aleph::generate_cross_graph | ( | GT & | g, |
| const size_t & | nodes_by_level, | ||
| const double & | xdist, | ||
| const double & | ydist, | ||
| std::ostream & | out, | ||
| SA | sa = SA() |
||
| ) |
Generate a cross-graph layout specification for graphpic.
Creates a graphpic specification with nodes arranged in a cross pattern. In this layout, even levels have (nodes_by_level - 1) nodes and odd levels have nodes_by_level nodes, creating a staggered pattern.
| GT | Graph type |
| Write_Node | Functor returning node label string |
| Write_Arc | Functor returning arc label string |
| Shade_Node | Functor returning shading command (e.g., "SHADOW-NODE") |
| Shade_Arc | Functor returning shading command (e.g., "SHADOW-ARC") |
| SA | Arc filter |
| g | Graph to visualize |
| nodes_by_level | Nodes per level (last level may have fewer) |
| xdist | Horizontal distance between nodes |
| ydist | Vertical distance between levels |
| out | Output stream for graphpic specification |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 823 of file generate_graph.H.
References GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), and out.
Referenced by Aleph::generate_cross_graph(), Aleph::generate_cross_graph(), and generate_cross_spanning_tree().
| void generate_cross_spanning_tree | ( | GT & | g, |
| const size_t & | nodes_by_level, | ||
| const double & | xdist, | ||
| const double & | ydist, | ||
| std::ofstream & | output, | ||
| SA | sa = SA() |
||
| ) |
Generate a cross-layout visualization of a spanning tree.
Creates a graphpic specification with nodes arranged in a cross pattern, with spanning tree edges highlighted.
| GT | Graph type |
| Write_Node | Functor to convert node content to string |
| Write_Arc | Functor to convert arc content to string |
| SA | Arc filter class |
| g | The graph containing the spanning tree |
| nodes_by_level | Number of nodes per level in the layout |
| xdist | Horizontal distance between nodes |
| ydist | Vertical distance between levels |
| output | Output stream for the graphpic specification |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 125 of file generate_spanning_tree_picture.H.
References Aleph::generate_cross_graph(), and output.
|
inline |
Generate a DOT representation of the digraph.
Creates a DOT file suitable for rendering with Graphviz. The output includes:
The appearance is controlled by the global configuration variables: with_power, with_nes, only_num, with_class, font_size.
| g | The digraph to export. |
| output | Output stream for the DOT data. |
Definition at line 280 of file load_digraph.H.
References Aleph::font_size, Aleph::generate_dot_file(), LocateFunctions< Container, Type >::get_it(), Aleph::Const_Iterator< It >::has_curr(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::only_num, output, Aleph::ranks(), Aleph::with_class, Aleph::with_nes, and Aleph::with_power.
Referenced by Aleph::generate_dot_file(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
| void Aleph::generate_graphpic | ( | const GT & | g, |
| const double & | xdist, | ||
| const double & | ydist, | ||
| std::ostream & | output, | ||
| SA | sa = SA() |
||
| ) |
Generate a graphpic specification for graph visualization.
Creates a text specification for the graphpic drawing program. Handles both graphs and digraphs, with support for curved arcs when bidirectional edges exist.
| g | The graph or digraph to visualize |
| xdist | Horizontal distance between nodes |
| ydist | Vertical distance between levels (currently unused) |
| output | Output stream for the graphpic specification |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 168 of file generate_graph.H.
References GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), nodes, output, and Aleph::size().
| void Aleph::generate_graphviz | ( | const GT & | g, |
| std::ostream & | out, | ||
| Node_Attr | node_attr = Node_Attr(), |
||
| Arc_Attr | arc_attr = Arc_Attr(), |
||
| const std::string & | rankdir = "TB", |
||
| SA | sa = SA() |
||
| ) |
Generate Graphviz DOT output with custom attribute functors.
Creates a DOT specification using custom functors to generate node and arc attributes. This is the most flexible version, allowing complete control over the DOT output.
node_attr(g, node, out) to write attributesarc_attr(g, arc, out) to write attributesExample attribute functor:
| GT | Graph type |
| Node_Attr | Node attribute generator functor |
| Arc_Attr | Arc attribute generator functor |
| SN | Node filter class |
| SA | Arc filter class |
| g | Graph to visualize |
| out | Output stream for DOT specification |
| node_attr | Functor for node attributes |
| arc_attr | Functor for arc attributes |
| rankdir | Layout direction: "TB", "BT", "LR", "RL" |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 376 of file generate_graph.H.
References GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and out.
| void Aleph::generate_graphviz | ( | const GT & | g, |
| std::ostream & | output, | ||
| const std::string & | rankdir = "TB", |
||
| float | ranksep = 0.2, |
||
| float | nodesep = 0.2, |
||
| SA | sa = SA() |
||
| ) |
Generate a Graphviz DOT specification for graph visualization.
Creates a DOT format specification for the Graphviz system (dot, neato, etc.). Supports both graphs and digraphs with configurable layout direction.
| g | The graph or digraph to visualize |
| output | Output stream for the DOT specification |
| rankdir | Layout direction: "TB" (top-bottom), "BT", "LR", "RL" |
| ranksep | Separation between ranks (topological levels) |
| nodesep | Separation between nodes in the same rank |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 258 of file generate_graph.H.
References GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), nodes, and output.
Referenced by Aleph::Generate_Graphviz< GT, Write_Node, Write_Arc, Shade_Node, Shade_Arc, Dashed_Node, Dashed_Arc, SA, SN >::operator()().
| void Aleph::generate_net_graph | ( | GT & | g, |
| const size_t & | nodes_by_level, | ||
| const double & | xdist, | ||
| const double & | ydist, | ||
| std::ostream & | out, | ||
| SA | sa = SA() |
||
| ) |
Generate a net-graph layout specification for graphpic.
Creates a graphpic specification with nodes arranged in a regular grid (net) pattern. Each level has exactly nodes_by_level nodes.
| GT | Graph type |
| Write_Node | Functor returning node label string |
| Write_Arc | Functor returning arc label string |
| Shade_Node | Functor returning shading command (e.g., "SHADOW-NODE") |
| Shade_Arc | Functor returning shading command (e.g., "SHADOW-ARC") |
| SA | Arc filter |
| g | Graph to visualize |
| nodes_by_level | Nodes per level (last level may have fewer) |
| xdist | Horizontal distance between nodes |
| ydist | Vertical distance between levels |
| out | Output stream for graphpic specification |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 881 of file generate_graph.H.
References GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), and out.
Referenced by Aleph::generate_net_graph(), Aleph::generate_net_graph(), and generate_net_spanning_tree().
| void generate_net_spanning_tree | ( | GT & | g, |
| const size_t & | nodes_by_level, | ||
| const double & | xdist, | ||
| const double & | ydist, | ||
| std::ofstream & | output, | ||
| SA | sa = SA() |
||
| ) |
Generate a net-layout visualization of a spanning tree.
Creates a graphpic specification with nodes arranged in a regular grid (net) pattern, with spanning tree edges highlighted.
| GT | Graph type |
| Write_Node | Functor to convert node content to string |
| Write_Arc | Functor to convert arc content to string |
| SA | Arc filter class |
| g | The graph containing the spanning tree |
| nodes_by_level | Number of nodes per level in the layout |
| xdist | Horizontal distance between nodes |
| ydist | Vertical distance between levels |
| output | Output stream for the graphpic specification |
| sa | the filter of the arcs, which each iterator copies |
Definition at line 173 of file generate_spanning_tree_picture.H.
References Aleph::generate_net_graph(), and output.
|
inline |
Convert a tree graph to a Tree_Node structure.
Takes a tree represented as an adjacency-list graph and converts it to a Tree_Node<Key> structure rooted at the specified node.
This enables the use of tree-specific algorithms and visualization tools on spanning trees extracted from graphs.
The Convert class is invoked for each node:
It should copy/transform data from the graph node to the tree node.
| GT | Graph type (derived from List_Graph) |
| Key | Data type for tree nodes |
| Convert | Converter class with operator()(gnode, tnode) |
| SA | Arc filter (default: show all arcs) |
| g | The tree graph to convert |
| groot | Node to use as the tree root |
| sa | the filter of the arcs, which each iterator copies |
| std::domain_error | If the arcs that SA shows have a cycle |
| std::bad_alloc | If memory allocation fails |
| anything | that Convert throws. If something throws, the tree that was built is freed. |
Definition at line 260 of file graph_to_tree.H.
References ah_domain_error_if, and Aleph::destroy_tree().
| size_t Aleph::greedy_coloring | ( | const GT & | g, |
| DynMapTree< typename GT::Node *, size_t > & | colors, | ||
| SA | sa = SA() |
||
| ) |
Greedy graph coloring in iteration order.
Assigns each node the smallest 0-based color index not already used by any of its colored neighbors, visiting nodes in their natural graph- iteration order. Uses at most \(\Delta+1\)colors where \(\Delta\) is the maximum degree.
| GT | Graph type (List_Graph, List_Digraph, Array_Graph, …). |
| SA | Arc-filter functor (defaults to Dft_Show_Arc<GT>). |
| [in] | g | Input graph. Must not contain self-loops. |
| [out] | colors | Output map from GT::Node* to 0-based color index. Cleared and overwritten on entry. |
| [in] | sa | The filter of the arcs, which each pass copies. |
| std::domain_error | if g contains a self-loop. |
g.NODE_COOKIE on every node during execution; prior cookie values are saved and restored automatically via Cookie_Saver before the function returns (even under exceptions). Do not call concurrently with any other code that reads or writes node cookies. Definition at line 199 of file Graph_Coloring.H.
References GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), NODE_COOKIE, and w.
Referenced by demo_algorithm_comparison(), demo_exam_scheduling(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
|
inline |
Return true if an undirected graph has at least one cycle.
| [in] | g | Graph to test. |
true if g contains a cycle; false otherwise.Definition at line 982 of file tpl_graph_utils.H.
References Aleph::is_graph_acyclique().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::hopcroft_karp_matching | ( | const GT & | g, |
| DynDlist< typename GT::Arc * > & | matching, | ||
| SA | sa = SA() |
||
| ) |
Computes a maximum cardinality matching on a bipartite graph using the Hopcroft-Karp algorithm.
The Hopcroft-Karp algorithm runs in O(E * sqrt(V)) time, which is more efficient than the max-flow based approach for sparse bipartite graphs.
This implementation handles disconnected graphs correctly.
| [in] | g | the bipartite graph. |
| [out] | matching | list of arcs forming the maximum matching. |
| [in] | sa | the filter of the arcs, which the bipartition, each iterator and each frame of the search copy. |
| domain_error | if the graph is not bipartite. |
Definition at line 575 of file tpl_bipartite.H.
References ah_domain_error_if, Aleph::and, Aleph::DynDlist< T >::append(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynListQueue< T >::is_empty(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, NODE_COUNTER, and Aleph::DynListQueue< T >::put().
Referenced by TEST(), and TYPED_TEST().
| Howard_Mean_Cycle_Result< GT, typename Distance::Distance_Type > Aleph::howard_minimum_mean_cycle | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA(), |
||
| const size_t | max_fallback_bytes = std::numeric_limits<size_t>::max() |
||
| ) |
Minimum mean cycle by Howard's policy iteration.
See the file documentation for the algorithm, its complexity and its arithmetic.
has_cycle = false.minimum_mean is the minimum cycle mean and the witness is a simple cycle attaining it, with its exact total cost and length. That is exact for integral costs and for floating-point costs that the exact verification could handle (numeric_quality is Exact); when it could not, or after the fallback to Karp, the cycle was chosen with rounded values (Rounded) and can be worse than the optimum when weights cancel across many orders of magnitude (see the file documentation). After the fallback the witness is still a simple cycle with the exact sum of its weights (rounded once for floating-point costs), and minimum_mean is Karp's value, which the witness attains up to Karp's rounding.The witness can differ from the one of karp_minimum_mean_cycle() when several cycles attain the minimum; the value is the same.
| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter; arcs it rejects do not exist. |
| [in] | g | Graph (must be directed). It is not modified. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
| [in] | max_fallback_bytes | Limit of the bytes of Karp's tables if the fallback runs (see the file documentation): 0 refuses any fallback; the default sets no limit. |
Howard_Mean_Cycle_Result. iterations counts the policy improvements; used_karp is true if Karp's algorithm computed the answer (on each component of the snapshot, see the file documentation), and fallback_reason says why: the iteration limit (V + 64), an overflow of the arithmetic of the policy evaluation, or a cost of the optimal cycle out of the range of the cost type; numeric_quality says whether the means were compared exactly.| std::domain_error | If g is undirected, or a floating weight (or an accumulated cost) is not finite. |
| std::overflow_error | If integer additions overflow. |
| std::length_error | If the fallback runs and Karp's tables need more than max_fallback_bytes bytes; the message gives the bytes, the size of the component and the reason of the fallback. Nothing else makes this function throw it. |
O(iterations * (V + E)) time and O(V + E) space, plus an expected O(V + E) for the snapshot of the graph; the distance accessor is called once per arc. If the fallback runs, add Karp's O(V_c E_c) time for every strongly connected component of the cyclic core, and O(V_c^2) space for the largest one.O(V^2) space. Definition at line 1513 of file Howard_Min_Mean_Cycle.H.
References Aleph::howard_detail::default_iterations.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| Min_Mean_Cycle_Value_Result Aleph::howard_minimum_mean_cycle_value | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA(), |
||
| const size_t | max_fallback_bytes = std::numeric_limits<size_t>::max() |
||
| ) |
Minimum mean cycle value by Howard's policy iteration, without the witness.
Same algorithm and requirements as howard_minimum_mean_cycle(), and the same minimum_mean bit for bit, but the cycle is not built: no lists of nodes and arcs, and if the fallback to Karp runs it keeps no table of predecessors (see the file documentation).
| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter; arcs it rejects do not exist. |
| [in] | g | Graph (must be directed). It is not modified. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
| [in] | max_fallback_bytes | Limit of the bytes of Karp's table if the fallback runs, as in howard_minimum_mean_cycle(); without predecessors that table takes fewer bytes. |
Min_Mean_Cycle_Value_Result, the type karp_minimum_mean_cycle_value() returns: whether a cycle exists and the minimum mean. It does not carry numeric_quality, used_karp or fallback_reason; call howard_minimum_mean_cycle() to know whether a floating-point mean was verified exactly.| std::domain_error | If g is undirected, or a floating weight (or an accumulated cost) is not finite. |
| std::overflow_error | If integer additions overflow. Unlike howard_minimum_mean_cycle(), not if only the cost of the cycle does not fit the cost type: no cost is reported, so after the fallback the mean is answered, as karp_minimum_mean_cycle_value() does. |
| std::length_error | If the fallback runs and Karp's table needs more than max_fallback_bytes bytes. |
Definition at line 1559 of file Howard_Min_Mean_Cycle.H.
References Aleph::howard_detail::default_iterations, Aleph::Min_Mean_Cycle_Value_Result::has_cycle, r, and value.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| Hungarian_Result< Cost_Type > Aleph::hungarian_assignment | ( | const DynMatrix< Cost_Type > & | cost | ) |
Compute minimum-cost assignment (free function).
Convenience free function that returns a Hungarian_Result.
| Cost_Type | Numeric type for costs. |
| [in] | cost | The m x n cost matrix. |
| std::overflow_error | as Hungarian_Assignment. |
Definition at line 607 of file Hungarian.H.
References Aleph::Hungarian_Result< Cost_Type >::col_to_row, Aleph::Hungarian_Assignment< Cost_Type >::cols(), Aleph::Hungarian_Assignment< Cost_Type >::get_total_cost(), Aleph::Hungarian_Result< Cost_Type >::orig_cols, Aleph::Hungarian_Result< Cost_Type >::orig_rows, Aleph::Hungarian_Result< Cost_Type >::row_to_col, Aleph::Hungarian_Assignment< Cost_Type >::rows(), and Aleph::Hungarian_Result< Cost_Type >::total_cost.
Referenced by Aleph::hungarian_max_assignment(), TEST(), TEST(), TEST(), and TYPED_TEST().
| Hungarian_Result< Cost_Type > Aleph::hungarian_max_assignment | ( | const DynMatrix< Cost_Type > & | cost | ) |
Compute maximum-profit assignment (free function).
Negates the cost matrix and solves the resulting minimization problem. The returned total_cost is the maximum profit (positive).
| Cost_Type | Numeric type for costs. |
| [in] | cost | The m x n profit matrix. |
| std::overflow_error | if a profit is the least of an integer type, which cannot be negated, or the maximum does not fit in the type, or as Hungarian_Assignment on the negated profits. |
Definition at line 648 of file Hungarian.H.
References ah_overflow_error_if, Aleph::DynMatrix< T >::allocate(), Aleph::and, Aleph::Hungarian_Result< Cost_Type >::col_to_row, cols, Aleph::DynMatrix< T >::cols(), Aleph::hungarian_assignment(), Aleph::Hungarian_Result< Cost_Type >::orig_cols, Aleph::Hungarian_Result< Cost_Type >::orig_rows, Aleph::DynMatrix< T >::read(), Aleph::Hungarian_Result< Cost_Type >::row_to_col, rows, Aleph::DynMatrix< T >::rows(), and Aleph::Hungarian_Result< Cost_Type >::total_cost.
Referenced by example_maximization(), TEST(), TEST(), TEST(), and TYPED_TEST().
| DynList< typename GT::Arc * > Aleph::in_arcs | ( | const GT & | g, |
| typename GT::Node * | p, | ||
| SA | sa = SA() |
||
| ) |
Return the arcs of g into p that sa shows.
On a digraph, which the function tells at run time, it looks for them among the arcs of the graph, in \(O(E)\), in their order; on a graph that is not directed, in the list of p.
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | sa | arc filter |
| bad_alloc | if there is no memory for the list |
Definition at line 2695 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::in_arcs_detail::traverse_arcs_into().
| DynList< typename GT::Arc * > Aleph::in_arcs | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the filtered incoming arcs of p.
It reads them from the list of p, as In_Iterator(p): it does not compile on a digraph type; use in_arcs(g, p, sa) there.
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2671 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by Aleph::MCF_Graph< NodeT, ArcT >::demands_satisfied(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| size_t Aleph::in_degree | ( | const GT & | g, |
| typename GT::Node * | p, | ||
| SA | sa = SA() |
||
| ) |
Compute the number of arcs of g into p that sa shows.
On a digraph, which keeps each arc only in the list of its source and which the function tells at run time, it counts the arcs of the graph whose target is p, in \(O(E)\); on a graph that is not directed, those of the list of p. To ask for many nodes of a digraph, build an In_Arcs_Index, whose in_degree() takes \(O(1)\).
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | sa | arc filter (by default all the arcs are counted) |
Definition at line 2834 of file tpl_graph.H.
References Aleph::count(), Aleph::in_arcs_detail::digraph_in_degree(), GraphCommon< GT, Node, Arc >::is_digraph(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| size_t Aleph::in_degree | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Compute the filtered in degree of node p.
It reads the arcs into p from the list of p, as In_Iterator(p), which holds them only in a graph that is not directed: it does not compile on a digraph type, and it cannot tell a graph of an undirected type that says that it is directed. Use in_degree(g, p, sa) there.
| [in] | p | node pointer |
| [in] | sa | arc filter (by default all the arcs are counted) |
in_degree<GT>(p) counts every incoming arc. Definition at line 2806 of file tpl_graph.H.
References Aleph::count(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::connect(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
| DynList< typename GT::Node * > Aleph::in_nodes | ( | const GT & | g, |
| typename GT::Node * | p, | ||
| SA | sa = SA() |
||
| ) |
Return the sources of the arcs of g into p that sa shows.
On a digraph, which keeps each arc only in the list of its source and which the function tells at run time, it looks for them among the arcs of the graph, in \(O(E)\); on a graph that is not directed, in the list of p.
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | sa | arc filter |
| bad_alloc | if there is no memory for the list |
Definition at line 2633 of file tpl_graph.H.
References Aleph::DynList< T >::append(), GTArcCommon< ArcInfo >::src_node, and Aleph::in_arcs_detail::traverse_arcs_into().
| DynList< typename GT::Node * > Aleph::in_nodes | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the nodes connected to the filtered incoming arcs to p.
It reads the arcs into p from the list of p, as In_Iterator(p), which holds them only in a graph that is not directed: it does not compile on a digraph type, and it cannot tell a graph of an undirected type that says that it is directed. Use in_nodes(g, p, sa) there.
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2606 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TEST(), TYPED_TEST(), and TYPED_TEST().
| DynList< ArcPair< GT > > Aleph::in_pairs | ( | const GT & | g, |
| typename GT::Node * | p, | ||
| SA | sa = SA() |
||
| ) |
Return the pairs (arc, source) of the arcs of g into p that sa shows.
On a digraph, which the function tells at run time, it looks for the arcs among those of the graph, in \(O(E)\); on a graph that is not directed, in the list of p.
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | sa | arc filter |
| bad_alloc | if there is no memory for the list |
Definition at line 2759 of file tpl_graph.H.
References Aleph::DynList< T >::append(), GTArcCommon< ArcInfo >::get_connected_node(), and Aleph::in_arcs_detail::traverse_arcs_into().
| DynList< ArcPair< GT > > Aleph::in_pairs | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the filtered incoming pairs of (arc,node) related to node p
It reads the arcs from the list of p, as In_Iterator(p): it does not compile on a digraph type; use in_pairs(g, p, sa) there.
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2731 of file tpl_graph.H.
References Aleph::DynList< T >::append(), GTArcCommon< ArcInfo >::get_connected_node(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TYPED_TEST().
Forward declaration for inconnected_components().
Compute the connected components as mapped subgraphs.
Builds a DynList<GT> where each element is a subgraph containing one connected component of g.
Side effects:
g.reset_nodes() and g.reset_arcs().Build_Subtree control bit on both nodes and arcs.g via cookies.| [in] | g | Graph to split, which is not directed: on a digraph, following the arcs that leave each node does not give the components, and an arc toward a component built before would point to a node of its subgraph. |
| domain_error | If g is a digraph. |
| bad_alloc | If there is not enough memory. |
Definition at line 1118 of file tpl_graph_utils.H.
References ah_domain_error_if, Aleph::and, Aleph::DynList< T >::append(), Aleph::build_subgraph(), Aleph::Build_Subtree, Aleph::count(), Aleph::DynList< T >::get_last(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
Referenced by TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().
| void Aleph::inter_copy_graph | ( | GTT & | gtgt, |
| const GTS & | gsrc, | ||
| const bool | cookie_map = false |
||
| ) |
Copy between different types of graphs.
| [in] | gtgt | target graph |
| [in] | gsrc | source graph |
| [in] | cookie_map | if true ==> a mapping will be done through nodes and arcs cookies |
Definition at line 4884 of file tpl_graph.H.
References Aleph::clear_graph(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TEST_F().
Compute the transpose (arc-reversed) digraph.
Builds a new digraph containing the same nodes as g and every arc reversed.
Side effects:
g.reset_nodes() and g.reset_arcs().g and the returned digraph via cookies.| [in] | g | Input digraph. |
g. | domain_error | If g is not a digraph. |
| bad_alloc | If there is not enough memory. |
Definition at line 2308 of file tpl_graph_utils.H.
References ah_domain_error_unless, Aleph::and, GraphCommon< GT, Node, Arc >::get_arc_it(), GTArcCommon< ArcInfo >::get_info(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), GraphCommon< GT, Node, Arc >::is_digraph(), GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
Referenced by Aleph::Lengauer_Tarjan_Post_Dominators< GT, SA >::ensure_computed(), Aleph::kosaraju_connected_components(), Aleph::kosaraju_connected_components(), TEST(), and TEST().
|
inline |
Return true if an undirected graph is acyclic.
Equivalent to calling is_graph_acyclique(g, node) for every connected component of g.
Test_Cycle control bit on both nodes and arcs. true for empty graphs. | [in] | g | Graph to test. |
true if g is acyclic; false otherwise. | domain_error | If g is a directed graph. |
Definition at line 944 of file tpl_graph_utils.H.
References Aleph::__is_graph_acyclique(), ah_domain_error_if, GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), IS_NODE_VISITED, num_nodes, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), GraphCommon< GT, Node, Arc >::reset_bit_nodes(), and Aleph::Test_Cycle.
|
inline |
Return true if an undirected graph is acyclic.
This is a cycle-detection routine for undirected graphs. It performs a DFS-like traversal while marking arcs to avoid immediately revisiting the parent edge.
Test_Cycle control bit on both nodes and arcs. true for empty graphs. | [in] | g | Graph to test. |
| [in] | start_node | Starting node (must be non-null and belong to g). |
true if the component reachable from start_node is acyclic; false otherwise. | domain_error | If g is a directed graph. |
Definition at line 907 of file tpl_graph_utils.H.
References Aleph::__is_graph_acyclique(), ah_domain_error_if, ah_invalid_argument_if, GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), num_nodes, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), GraphCommon< GT, Node, Arc >::reset_bit_nodes(), and Aleph::Test_Cycle.
Referenced by Aleph::has_cycle(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
| bool Aleph::is_planar_graph | ( | const GT & | g, |
| const Planarity_Test_Options & | options | ||
| ) |
Overload with default arc selector.
Definition at line 2921 of file Planarity_Test.H.
References options.
| bool Aleph::is_planar_graph | ( | const GT & | g, |
| SA | sa = SA(), |
||
| const Planarity_Test_Options & | options = Planarity_Test_Options() |
||
| ) |
High-level boolean check for graph planarity.
A convenience API that returns only the planarity status.
| [in] | g | The input graph. |
| [in] | sa | Arc filter. |
| [in] | options | Configuration (used if embedding is needed for check). |
true if the graph is planar, false otherwise. Definition at line 2909 of file Planarity_Test.H.
References Aleph::Planarity_Test_Result< GT >::is_planar, and options.
|
inline |
Check if a directed graph is strongly connected.
A directed graph is strongly connected if there is exactly one SCC containing all nodes.
| GT | Graph type (must be a directed graph). |
| [in] | g | The directed graph. |
Definition at line 466 of file kosaraju.H.
References GraphCommon< GT, Node, Arc >::get_num_nodes(), and Aleph::kosaraju_scc_count().
Referenced by TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| bool Aleph::is_valid_coloring | ( | const GT & | g, |
| const DynMapTree< typename GT::Node *, size_t > & | colors, | ||
| SA | sa = SA() |
||
| ) |
Validates a graph coloring.
A coloring is valid iff every graph node has a color entry in colors and no arc connects two nodes of the same color. Self-loops are considered invalid regardless of color assignment.
A size match alone between colors and the graph is insufficient: the map could be keyed with foreign (non-graph) pointers of the same count. This function explicitly verifies that every GT::Node* in g has an entry before checking arc conflicts.
| GT | Graph type (List_Graph, List_Digraph, Array_Graph, …). |
| SA | Arc-filter functor (defaults to Dft_Show_Arc<GT>). |
| [in] | g | Graph to validate against. |
| [in] | colors | Map from GT::Node* to 0-based color index. |
| [in] | sa | The filter of the arcs. |
true iff every node is present in colors and no arc connects same-colored endpoints; false otherwise (including self-loops and missing/foreign map entries).g and colors are not concurrently modified. Definition at line 450 of file Graph_Coloring.H.
References GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), and Aleph::DynMapTree< Key, Data, Tree, Compare >::search().
Referenced by demo_algorithm_comparison(), demo_cookie_safety(), demo_register_allocation(), print_coloring(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > Aleph::karp_minimum_mean_cycle | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Compute minimum mean cycle by Karp's algorithm.
Behavior:
has_cycle = false.minimum_mean and a witness: a simple cycle. The predecessors of the table give a walk of V arcs to the vertex witness_node; it is decomposed into simple cycles and the one of smallest mean is reported (means compared exactly for integral costs where 128-bit integers exist, in long double otherwise). In exact arithmetic every one of them has the minimum mean; with floating-point costs the reported one attains minimum_mean up to rounding, and its cycle_total_cost is the sum of its weights in arc order.| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter. |
| [in] | g | Graph (must be directed). |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
Min_Mean_Cycle_Result<GT, Cost_Type>.| domain_error | If `g` is undirected. |
| domain_error | If floating weights are not finite. |
| overflow_error | If the cost of the witness does not fit the cost type (no minimum-mean cycle the table gave fits it), or a checked integer addition overflows (see the file documentation). |
sa; the witness cost is summed from those values. Definition at line 965 of file Min_Mean_Cycle.H.
References ah_domain_error_if, ah_overflow_error_if, Aleph::DynList< T >::append(), Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_arcs, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_length, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_nodes, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_total_cost, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::has_cycle, Aleph::min_mean_cycle_detail::incoming_lists(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::minimum_mean, nodes, and Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::witness_node.
Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| Min_Mean_Cycle_Value_Result Aleph::karp_minimum_mean_cycle_value | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Compute only the minimum mean value (without witness walk).
This variant avoids predecessor storage and witness reconstruction. It is useful when only the optimal mean value is required. Its table and arithmetic are those of karp_minimum_mean_cycle(), so both return the same minimum_mean.
| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter. |
| [in] | g | Graph (must be directed). |
| [in] | distance | Arc cost accessor, called once per accepted arc. |
| [in] | sa | Arc filter. |
| domain_error | If `g` is undirected, or floating weights (or their sums) are not finite. |
| overflow_error | If a checked integer addition overflows: never for integer costs of at most 64 bits where 128-bit integers exist (see the file documentation). |
Definition at line 1023 of file Min_Mean_Cycle.H.
References ah_domain_error_if, Aleph::Min_Mean_Cycle_Value_Result::has_cycle, Aleph::min_mean_cycle_detail::incoming_lists(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Min_Mean_Cycle_Value_Result::minimum_mean, and nodes.
Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Compute strongly connected components as lists of nodes.
This is a lightweight version of Kosaraju's algorithm that returns the SCCs as lists of node pointers rather than full subgraphs. This is more efficient when you only need to know which nodes belong to which component, without needing the induced subgraphs.
Time complexity: O(V + E) Space complexity: O(V + E) for the transposed graph
| GT | Graph type (must be a directed graph). |
| [in] | g | The directed graph. |
Definition at line 359 of file kosaraju.H.
References Aleph::__dfp_phase1(), Aleph::__dfp_phase2_list(), Aleph::DynList< T >::append(), ARC_COOKIE, Aleph::Depth_First, Aleph::df(), GraphCommon< GT, Node, Arc >::for_each_arc(), GraphCommon< GT, Node, Arc >::get_node_it(), Aleph::invert_digraph(), IS_NODE_VISITED, NODE_COOKIE, GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
|
inline |
Compute strongly connected components using Kosaraju's algorithm.
This function computes the strongly connected components (SCCs) of a directed graph using Kosaraju's algorithm. The algorithm works in two phases:
The resulting SCCs are returned as subgraphs, with nodes and arcs mapped to the original graph via cookies. Arcs that cross between different SCCs are collected in a separate list.
Time complexity: O(V + E) Space complexity: O(V + E) for the transposed graph
| GT | Graph type (must be a directed graph). |
| [in] | g | The directed graph. Must not be modified during execution. |
| [out] | blk_list | List of subgraphs, one per SCC. Each subgraph is mapped to g via node and arc cookies. |
| [out] | arc_list | List of arcs that cross between different SCCs (inter-component arcs). |
Definition at line 267 of file kosaraju.H.
References Aleph::__dfp_phase1(), Aleph::__dfp_phase2_subgraph(), Aleph::DynArray< T >::access(), Aleph::DynList< T >::append(), ARC_COOKIE, Aleph::color(), Aleph::Depth_First, Aleph::df(), GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::invert_digraph(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), NODE_COLOR, NODE_COOKIE, GraphCommon< GT, Node, Arc >::reset_arcs(), and GraphCommon< GT, Node, Arc >::reset_nodes().
Referenced by example_basic_sccs(), example_dag(), example_lightweight_version(), example_strongly_connected(), Aleph::kosaraju_scc_count(), Aleph::Kosaraju_Connected_Components< GT >::operator()(), Aleph::Kosaraju_Connected_Components< GT >::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Count the number of strongly connected components.
Computes the number of SCCs in the graph without building the actual component lists.
| GT | Graph type (must be a directed graph). |
| [in] | g | The directed graph. |
Definition at line 445 of file kosaraju.H.
References Aleph::kosaraju_connected_components().
Referenced by Aleph::is_strongly_connected(), TEST(), and TYPED_TEST().
|
inline |
Load nodes and arcs from streams into the directed graph.
Reads nodes from a pipe-separated file and arcs from a space/comma separated file, populating the graph.
The nodes file format:
The arcs file format:
| g | The digraph to populate. |
| nodes_input | Input stream for node data. |
| arcs_input | Input stream for arc data. |
Definition at line 201 of file load_digraph.H.
References Aleph::load_digraph(), Aleph::MIN_NODE_FIELDS, Aleph::search_node(), Aleph::DynDlist< T >::size(), and Aleph::split().
Referenced by Aleph::load_digraph(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
noexcept |
Map two arcs of different types of graphs through their cookies.
| [in] | p | pointer to the source arc |
| [in] | q | pointer to the target arc |
Definition at line 4759 of file tpl_graph.H.
References Aleph::and, and ARC_COOKIE.
| std::tuple< GT, DynList< typename GT::Arc * > > Aleph::map_cut_graph | ( | const GT & | g, |
| const DynList< typename GT::Node * > & | cut_node_list | ||
| ) |
Extract the cut graph and cross-arc list.
Requires a graph previously processed by:
Cut bitThe returned cut graph contains:
Cut bit on arcs)Cross arcs (cut → non-cut) are returned separately in cross_arc_list.
| [in] | g | Painted graph. |
| [in] | cut_node_list | Cut nodes list. |
{cut_graph, cross_arc_list}. | bad_alloc | If there is not enough memory. |
Definition at line 2222 of file tpl_graph_utils.H.
References Aleph::and, Aleph::DynList< T >::append(), ARC_COOKIE, GraphCommon< GT, Node, Arc >::get_arc_it(), LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), and NODE_COOKIE.
Referenced by TEST(), TEST(), TEST(), and TYPED_TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument.
Definition at line 3249 of file tpl_graph.H.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
Its third template parameter, which only that type satisfies, keeps the call that names it, map_in_arcs<GT, T, std::function<T (Arc *)>>, which the generic one took before it left that type to this overload.
Definition at line 3211 of file tpl_graph.H.
|
noexcept |
Map two nodes of different types of graphs through their cookies.
| [in] | p | pointer to the source node |
| [in] | q | pointer to the target node |
Definition at line 4731 of file tpl_graph.H.
References Aleph::and, and NODE_COOKIE.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
Its third template parameter keeps the call that names that type, as in map_in_arcs(p, op).
Definition at line 3502 of file tpl_graph.H.
Extract a mapped subgraph containing a given color.
Assumes g has been painted (e.g., via paint_subgraphs()) and extracts the connected block whose nodes/arcs have the given positive color.
Side effects:
Build_Subtree control bit on all nodes and arcs.Build_Subtree control bit during extraction.g and the returned subgraph via cookies.| [in] | g | Painted graph. |
| [in] | color | Color value to extract. |
color. | domain_error | If color does not exist in g. |
| bad_alloc | If there is not enough memory. |
Definition at line 2172 of file tpl_graph_utils.H.
References Aleph::__map_subgraph(), ah_domain_error_if, Aleph::Build_Subtree, Aleph::color(), GraphCommon< GT, Node, Arc >::get_node_it(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), GraphCommon< GT, Node, Arc >::map_nodes(), NODE_BITS, NODE_COOKIE, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), and GraphCommon< GT, Node, Arc >::reset_bit_nodes().
Referenced by TEST(), TEST(), TEST(), and TYPED_TEST().
Return the mapped node through the cookie of p
Definition at line 3622 of file tpl_graph.H.
References NODE_COOKIE.
| Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > Aleph::minimum_mean_cycle | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Alias for karp_minimum_mean_cycle().
Definition at line 1059 of file Min_Mean_Cycle.H.
Referenced by TEST(), and TYPED_TEST().
| Min_Mean_Cycle_Value_Result Aleph::minimum_mean_cycle_value | ( | const GT & | g, |
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Alias for karp_minimum_mean_cycle_value().
Definition at line 1048 of file Min_Mean_Cycle.H.
Referenced by TEST(), and TYPED_TEST().
| Bounded_Cycle_Result< GT, typename Distance::Distance_Type > Aleph::most_negative_cycle_bounded | ( | const GT & | g, |
| const size_t | max_length, | ||
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Most negative simple cycle of at most max_length arcs, ranked by total cost (not by mean cost as Karp's algorithm does).
Finding the most negative simple cycle of bounded length exactly is exponential in the bound (it amounts to enumerating simple paths, which explodes on graphs with hub nodes). The function solves in polynomial time a relaxed problem and then repairs its answer.
Let L = min(max_length, V). For every node v taken as origin, the arcs are relaxed layer by layer from D_0[v] = 0 (every other node unreached): D_k[u] is the minimum cost of a walk of exactly k arcs from v to u, with the constraint that v is left only in the first step. Hence D_k[v] is the minimum cost of a closed walk of exactly k arcs that leaves v once and does not pass through v again before its last arc. The relaxed set W is the set of those walks for all v and all k <= L; best_walk is the minimum of their costs. W is not "all closed walks": a walk that goes through its origin in the middle is not in it. It contains every simple cycle of at most L arcs (seen from any of its own nodes), so in exact arithmetic best_walk <= c_opt, the cost of the best simple cycle.
Capping max_length at V loses no simple cycle, because a simple cycle has at most V arcs. It does bound the walks of W: a walk of W can repeat a cycle hanging from an interior node, so it may have more than V arcs, and those are not examined.
A minimum-cost walk of W may repeat a node other than its origin: v -> u -> a -> u -> b -> u -> v (6 arcs) goes around the two cycles hanging from u and, if each of them costs -2, beats a simple triangle of cost -3 through v. Ranking by "one execution of the
cycle" needs simple cycles, so for every origin v and every length k with D_k[v] reached, the walk the dynamic program selects (reconstructed from per-step predecessors) is decomposed into simple cycles, and each component is offered as a candidate. The most negative candidate is returned; among candidates of equal cost, the one with fewest arcs (with floating-point costs the candidates are compared by the exact sums of their weights). This keeps the cost polynomial and gives:
max_length arcs with its exact total cost (as evaluated), never better than the true optimum: c_opt <= total_cost;best_walk (matches_relaxed_bound), it is the minimum cost of a simple cycle within the bound: c_opt <= total_cost = best_walk <= c_opt. That argument needs exact sums. With floating-point costs the dynamic program rounds, but every value it computes is at most the rounded sum of any walk it represents (rounding is monotonic), so the true minimum over W is at least best_walk minus a bound of the rounding of a sum of L weights. optimality_gap is the reported cost minus that lower bound: a rigorous bound of total_cost - c_opt, zero exactly when is_exact proves the optimum;best_walk decomposes into m simple cycles, c_opt <= total_cost <= best_walk / m <= c_opt / m, which for a negative optimum means the reported cycle earns at least 1/m of the best possible gain;(k, u) the dynamic program keeps a single predecessor, so when several walks of equal cost exist only one of them is decomposed; a simple cycle of the same cost, or with fewer arcs, may therefore never become a candidate. The function does not promise the globally cheapest, nor the globally shortest among the cheapest, simple cycle unless is_exact certifies the cost.Every cycle lies inside one strongly connected component, and a walk that leaves its component can never return to its origin. Before the dynamic program the snapshot is therefore reduced to its cyclic core: the arcs whose two ends are in the same component (self-loops and parallel arcs included, so a node with a self-loop is a cyclic component) and the nodes they touch. Origins, steps and relaxations only see the core; this changes none of the closed walks, the relaxed set W, best_walk, the candidates offered or their order, so the result, is_exact included, is the same as without the reduction. The bound L is still taken from the whole graph: bounding each component by its own size would drop non-simple walks the certificate ranges over.
A step relaxes the arcs that leave the nodes reached in the previous step. For each node reached in step k the predecessor is the cheapest arc into it and, among equally cheap arcs, the one with the lowest index in the snapshot (the order in which the arc iterator of g visits them), however the arcs are visited. A step whose reached nodes own few of the arcs visits just those through an out-adjacency; otherwise it scans every arc in index order, which is faster than many short lists. Both ways give the same walks.
Arcs outside the core are never accumulated, so an integer overflow that involves only them is not reported; floating-point weights are still checked for finiteness for every arc the filter accepts, when the graph is snapshotted.
Choosing max_length <= 3 rules out walks that repeat an interior node when the graph has no self-loops, so the result is then optimal (in the arithmetic of the search, for floating-point costs). In market graphs the minimum-cost walk is often simple, but that is an empirical observation and not a guarantee: the repeated part can be a negative cycle by itself (a profitable triangle traversed twice).
| GT | Directed Aleph graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter; arcs it rejects do not exist for the search. |
| [in] | g | Graph (must be directed). It is not modified. |
| [in] | max_length | Maximum number of arcs of the cycle; 0 yields has_cycle = false without touching the graph (no validation, no call to the accessor). Values above the node count are capped to it, which loses no simple cycle (a simple cycle has at most V arcs) but limits the closed walks that the certificate is_exact ranges over. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
Bounded_Cycle_Result; has_cycle is false when no cycle of at most max_length arcs exists. The reported cycle can have non-negative cost when no negative cycle exists within the bound: check is_negative(), whose answer is exact. optimality_gap bounds how far from the optimum the cycle can be, and numeric_quality says whether the search was exact. The node and arc pointers refer to g.| std::domain_error | If g is undirected or a floating weight (or an accumulated sum) is not finite. |
| std::overflow_error | If integer additions overflow (on the arcs of the cyclic core), or the predecessor table size overflows size_t. |
| std::bad_alloc | If the O(L · V_c) tables do not fit in memory (a large core searched with max_length near V). |
L = min(max_length, V) and V_c, E_c the nodes and arcs of the cyclic core (see the file documentation). The last term is the reconstruction and decomposition of the closed walks, O(L) for each origin and length that closes one. It is not absorbed by the relaxation: L is bounded by the nodes of the whole graph, so a small core searched with a large bound is quadratic in L (two cyclic nodes among V, searched with max_length = V, cost Θ(V²)). The usual O(V_c · L · E_c) form holds when E_c >= V_c and L <= E_c. With floating-point costs, ranking the candidates by their exact sums multiplies the reconstruction term by the length of those sums as expansions (one to three components for weights of similar magnitudes), and the certificate adds O(E_c).Definition at line 1747 of file Negative_Cycles.H.
References ah_logic_error_if, ah_overflow_error_if, Aleph::and, Aleph::Array< T >::append(), Aleph::negative_cycles_detail::Indexed_Graph< GT, Cost_Type >::arcs, Aleph::negative_cycles_detail::Best_Cycle< Cost_Type >::arcs, Aleph::negative_cycles_detail::build_out_adjacency(), Aleph::negative_cycles_detail::check_finite(), Aleph::shortest_path_detail::checked_add(), Aleph::negative_cycles_detail::Best_Cycle< Cost_Type >::cost, Aleph::negative_cycles_detail::cycle_cost(), Aleph::negative_cycles_detail::cyclic_core(), Aleph::Array< T >::empty(), Aleph::negative_cycles_detail::Best_Cycle< Cost_Type >::found, Aleph::negative_cycles_detail::index_graph(), k, m, adaptive_huffman_demo::Snapshot::nodes, Aleph::negative_cycles_detail::Indexed_Graph< GT, Cost_Type >::nodes, Aleph::none(), Aleph::Bounded_Cycle_Result< GT, Cost_Type >::numeric_quality, Aleph::negative_cycles_detail::offer_simple_components(), pred, Aleph::Array< T >::reserve(), Aleph::Rounded, OhashCommon< HashTbl, Key >::size(), Aleph::Array< T >::size(), and Aleph::Array< T >::swap().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| Short_Cycle_Result< GT, typename Distance::Distance_Type > Aleph::most_negative_cycle_up_to_3 | ( | const GT & | g, |
| const size_t | max_length = 3, |
||
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Minimum-total-cost simple cycle with at most one, two or three arcs.
This independent, exact search enumerates self-loops, opposite arc pairs and directed triangles. Among equal exact costs it returns the shortest cycle; remaining ties are deterministic for a fixed snapshot order. Each ordered pair retains its cheapest accepted arc (first in snapshot order on a tie), so parallel arcs do not multiply the triangle search. Replacing a parallel arc by a cheaper one cannot worsen a simple cycle.
Floating-point candidates are ordered by exact sums of the binary weights, using error-free expansions when a rigorous rounding filter cannot decide. The published cost is within one ulp of that sum and has its exact sign. Requires round-to-nearest arithmetic without reassociation/fast-math, as described in the file documentation. Only the total of the reported cycle has to fit the cost type: a cycle whose total is above it is worse than any that fits and is skipped, whatever its partial sums; one below it would be the best and has no representable total. No closed-walk relaxation or certificate from that relaxation is used.
The graph is not modified. Each accepted arc's weight is read once. Returned pointers belong to g; concurrent calls require that nobody changes the graph and that the accessor and filter permit concurrent use.
| GT | Directed Aleph graph type. |
| Distance | Arc weight accessor. |
| SA | Arc filter; rejected arcs do not exist for this search. |
| [in] | g | Graph to search. |
| [in] | max_length | Bound in [0, 3], default 3. Zero returns an empty result without validation or calls to the accessor/filter. |
| [in] | distance | Arc weight accessor. |
| [in] | sa | Arc filter. |
has_cycle includes non-negative cycles. is_negative() decides existence of a negative cycle in the bound. | std::invalid_argument | If max_length > 3 (before graph access). |
| std::domain_error | If the graph is undirected, an accepted weight is not finite, or the total of the best floating-point cycle (or an exact comparison) exceeds the format. |
| std::overflow_error | If the total of the best integral cycle does not fit the cost type. |
Definition at line 2280 of file Negative_Cycles.H.
References Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::above_range, ah_domain_error_if, ah_invalid_argument_if, ah_overflow_error_if, Aleph::and, Aleph::DynList< T >::append(), Aleph::negative_cycles_detail::Out_Adjacency< Cost_Type >::arc, Aleph::negative_cycles_detail::Indexed_Graph< GT, Cost_Type >::arcs, Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::arcs, Aleph::negative_cycles_detail::build_out_adjacency(), Aleph::negative_cycles_detail::cheapest_parallel_arcs(), Aleph::Short_Cycle_Result< GT, Cost_Type >::cycle_arcs, Aleph::Short_Cycle_Result< GT, Cost_Type >::cycle_nodes, Aleph::negative_cycles_detail::cyclic_core(), Aleph::fill(), Aleph::Short_Cycle_Result< GT, Cost_Type >::has_cycle, Aleph::negative_cycles_detail::index_graph(), Aleph::Short_Cycle_Result< GT, Cost_Type >::length, Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::length, Aleph::negative_cycles_detail::Indexed_Graph< GT, Cost_Type >::nodes, Aleph::none(), Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::offer(), Aleph::Array< T >::size(), Aleph::negative_cycles_detail::Out_Adjacency< Cost_Type >::start, Aleph::negative_cycles_detail::Out_Adjacency< Cost_Type >::tgt, Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::total(), Aleph::Short_Cycle_Result< GT, Cost_Type >::total_cost, and w.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
| Container< T > Aleph::nodes_map | ( | GT & | g, |
| Op | transformation, | ||
| SN | sn = SN() |
||
| ) |
Map the filtered nodes of a graph to a transformed type.
| GT | Graph type |
| T | Result type |
| Container | Container type (default: DynList) |
| SN | Node filter type (default: Dft_Show_Node<GT>) |
| [in] | g | the graph |
| [in] | transformation | function Node* -> T that transforms each node |
| [in] | sn | node filter functor (default: Dft_Show_Node<GT>) |
Container<T> object with all the nodes mapped through the transformation Definition at line 1453 of file tpl_graph.H.
| Container< T > Aleph::nodes_map | ( | GT & | g, |
| std::function< T(typename GT::Node *)> | transformation, | ||
| SN | sn = SN() |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload for callers that pass an actual std::function<T (typename GT::Node *)> (rather than a lambda or other callable) and rely on T being deduced from it, as the generic overload above cannot: T appears only in its return type and requires clause, never in a parameter, so it is not a deduced context there.
Definition at line 1478 of file tpl_graph.H.
| bool Aleph::nonplanar_certificate_is_valid | ( | const Planarity_Test_Result< GT > & | result | ) |
Convenience predicate over validate_nonplanar_certificate().
Definition at line 4073 of file Planarity_Test.H.
References Aleph::NonPlanar_Certificate_Validation< GT >::is_valid, and Aleph::validate_nonplanar_certificate().
Referenced by TEST().
| std::string Aleph::nonplanar_certificate_to_dot | ( | const Planarity_Test_Result< GT > & | result, |
| Node_Label | node_label = Node_Label(), |
||
| const NonPlanar_Certificate_Export_Options & | options = NonPlanar_Certificate_Export_Options() |
||
| ) |
Export non-planar certificate as GraphViz DOT.
Requires result.has_nonplanar_certificate.
Definition at line 3857 of file Planarity_Test.H.
References ah_runtime_error_unless, Aleph::and, Aleph::Planarity_Test_Result< GT >::certificate_branch_nodes, Aleph::Planarity_Test_Result< GT >::certificate_obstruction_edges, Aleph::Planarity_Test_Result< GT >::certificate_paths, Aleph::Planarity_Test_Result< GT >::certificate_type, Aleph::planarity_detail::collect_certificate_nodes(), Aleph::color(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::planarity_detail::dot_escape_string(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::Planarity_Test_Result< GT >::has_nonplanar_certificate, Aleph::DynSetTree< Key, Tree, Compare >::insert(), k, nodes, options, out, palette_size(), and Aleph::to_string().
| std::string Aleph::nonplanar_certificate_to_gexf | ( | const Planarity_Test_Result< GT > & | result, |
| Node_Label | node_label = Node_Label(), |
||
| const NonPlanar_Certificate_Export_Options & | options = NonPlanar_Certificate_Export_Options() |
||
| ) |
Export non-planar certificate as GEXF.
Requires result.has_nonplanar_certificate.
Definition at line 4188 of file Planarity_Test.H.
References ah_runtime_error_unless, Aleph::and, Aleph::Planarity_Test_Result< GT >::certificate_branch_nodes, Aleph::Planarity_Test_Result< GT >::certificate_obstruction_edges, Aleph::Planarity_Test_Result< GT >::certificate_paths, Aleph::planarity_detail::collect_certificate_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::Planarity_Test_Result< GT >::has_nonplanar_certificate, Aleph::DynSetTree< Key, Tree, Compare >::insert(), k, nodes, options, out, Aleph::planarity_detail::pointer_to_string(), and Aleph::planarity_detail::xml_escape_string().
| std::string Aleph::nonplanar_certificate_to_graphml | ( | const Planarity_Test_Result< GT > & | result, |
| Node_Label | node_label = Node_Label(), |
||
| const NonPlanar_Certificate_Export_Options & | options = NonPlanar_Certificate_Export_Options() |
||
| ) |
Export non-planar certificate as GraphML.
Requires result.has_nonplanar_certificate.
Definition at line 4085 of file Planarity_Test.H.
References ah_runtime_error_unless, Aleph::and, Aleph::Planarity_Test_Result< GT >::certificate_branch_nodes, Aleph::Planarity_Test_Result< GT >::certificate_obstruction_edges, Aleph::Planarity_Test_Result< GT >::certificate_paths, Aleph::planarity_detail::collect_certificate_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::Planarity_Test_Result< GT >::has_nonplanar_certificate, Aleph::DynSetTree< Key, Tree, Compare >::insert(), k, nodes, options, out, Aleph::planarity_detail::pointer_to_string(), and Aleph::planarity_detail::xml_escape_string().
Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
| std::string Aleph::nonplanar_certificate_to_json | ( | const Planarity_Test_Result< GT > & | result, |
| Node_Label | node_label = Node_Label(), |
||
| const NonPlanar_Certificate_Export_Options & | options = NonPlanar_Certificate_Export_Options() |
||
| ) |
Export non-planar certificate as JSON.
Requires result.has_nonplanar_certificate.
Definition at line 3705 of file Planarity_Test.H.
References ah_runtime_error_unless, Aleph::Planarity_Test_Result< GT >::certificate_branch_nodes, Aleph::Planarity_Test_Result< GT >::certificate_obstruction_edges, Aleph::Planarity_Test_Result< GT >::certificate_paths, Aleph::Planarity_Test_Result< GT >::certificate_search_truncated, Aleph::Planarity_Test_Result< GT >::certificate_type, Aleph::planarity_detail::collect_certificate_nodes(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::Planarity_Test_Result< GT >::has_nonplanar_certificate, Aleph::planarity_detail::json_escape_string(), k, nodes, options, out, Aleph::planarity_detail::pointer_to_string(), Aleph::Array< T >::size(), and Aleph::to_string().
| DynList< typename GT::Arc * > Aleph::out_arcs | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the filtered incoming arcs of p.
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2652 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| size_t Aleph::out_degree | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Compute the filtered out degree of node p
| [in] | p | node pointer |
| [in] | sa | arc filter (by default all the arcs are counted) |
out_degree<GT>(p) counts every outgoing arc. Definition at line 2859 of file tpl_graph.H.
References Aleph::count(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| DynList< typename GT::Node * > Aleph::out_nodes | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the nodes connected to the filtered outcoming arcs of p.
| [in] | p | node pointer |
| [in] | sa | arc filter |
Definition at line 2583 of file tpl_graph.H.
References Aleph::DynList< T >::append(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
| DynList< ArcPair< GT > > Aleph::out_pairs | ( | typename GT::Node * | p, |
| SA | sa = SA() |
||
| ) |
Return the filtered outcoming pairs of (arc,node) related to node p
| [in] | p | node pointer |
| [in] | sa | arc filter |
DynList<ArcPair<GT>> containing the outcoming pairs Definition at line 2778 of file tpl_graph.H.
References Aleph::DynList< T >::append(), GTArcCommon< ArcInfo >::get_connected_node(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
|
inline |
Paint connected blocks around articulation points.
Given a list of cut nodes (typically computed with compute_cut_nodes()), paints the graph so that each biconnected block around the cut nodes gets a distinct positive "color".
Color storage:
NODE_COUNTER(node).ARC_COUNTER(arc).Special markers:
0.ARC_COUNTER(arc) == Cross_Arc.Cut control bit on arcs.Return value:
1.[1, return_value - 1]).Protocol:
Cut bit on nodes must already mark cut nodes.Side effects:
0 before painting.| [in] | g | Graph to paint. |
| [in] | cut_node_list | Cut nodes list (as returned by compute_cut_nodes()). |
Definition at line 2044 of file tpl_graph_utils.H.
References Aleph::__paint_from_cut_node(), LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::reset_counter_arcs(), and GraphCommon< GT, Node, Arc >::reset_counter_nodes().
Referenced by TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| Planar_Dual_Metadata< GT > Aleph::planar_dual_metadata | ( | const Planarity_Test_Result< GT > & | result | ) |
Build face and dual-edge metadata from a planar embedding result.
Requires result.is_planar and result.has_combinatorial_embedding.
Definition at line 2933 of file Planarity_Test.H.
References ah_runtime_error_if, ah_runtime_error_unless, Aleph::and, Aleph::Array< T >::append(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::Planar_Dual_Metadata< GT >::Face_Boundary::darts, Aleph::Planar_Dual_Metadata< GT >::dual_edges, Aleph::Planarity_Test_Result< GT >::embedding_rotation, Aleph::Planar_Dual_Edge_Info< GT >::face_a, Aleph::Planar_Dual_Metadata< GT >::face_adjacency, Aleph::Planar_Dual_Edge_Info< GT >::face_b, Aleph::Planar_Dual_Metadata< GT >::faces, Aleph::Planar_Dual_Metadata< GT >::faces_are_component_local, Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::Array< T >::get_last(), Aleph::Planarity_Test_Result< GT >::has_combinatorial_embedding, Aleph::Planar_Dual_Metadata< GT >::has_embedding, Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Array< T >::is_empty(), Aleph::Planarity_Test_Result< GT >::is_planar, m, Aleph::next(), Aleph::planarity_detail::Null_Edge, Aleph::Planar_Dual_Metadata< GT >::num_components, Aleph::Planar_Dual_Metadata< GT >::num_faces_global, Aleph::Planar_Dual_Metadata< GT >::num_faces_local, Aleph::Planar_Dual_Edge_Info< GT >::primal_src, Aleph::Planar_Dual_Edge_Info< GT >::primal_tgt, Aleph::Array< T >::remove_last(), Aleph::Array< T >::reserve(), Aleph::Planarity_Test_Result< GT >::simplified_num_edges, Aleph::Planarity_Test_Result< GT >::simplified_num_nodes, Aleph::Array< T >::size(), Aleph::Planar_Dual_Metadata< GT >::Face_Dart::src, and Aleph::Planar_Dual_Metadata< GT >::Face_Dart::tgt.
Referenced by Aleph::build_planar_dual_graph(), main(), Aleph::planar_geometric_drawing(), TEST(), TEST(), TEST(), and TEST().
| Planar_Geometric_Drawing< GT > Aleph::planar_geometric_drawing | ( | const Planarity_Test_Result< GT > & | result, |
| const Planar_Geometric_Drawing_Options & | options = Planar_Geometric_Drawing_Options() |
||
| ) |
Build embedding-aware 2D node coordinates from a planar result.
The drawing uses combinatorial embedding information. For each component, it places a candidate outer-face boundary on a circle and applies harmonic relaxation to interior nodes. Multiple deterministic outer-face candidates are evaluated to reduce crossings.
Requires result.is_planar and result.has_combinatorial_embedding.
Definition at line 3223 of file Planarity_Test.H.
References ah_runtime_error_if, ah_runtime_error_unless, Aleph::and, Aleph::Array< T >::append(), Aleph::Planar_Geometric_Drawing< GT >::chosen_outer_face, Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::Planar_Geometric_Drawing< GT >::crossing_count, Aleph::Planar_Geometric_Drawing< GT >::drawing_available, Aleph::Planar_Geometric_Drawing< GT >::drawing_search_truncated, Aleph::Planar_Geometric_Drawing< GT >::drawing_validated_no_crossings, Aleph::Planarity_Test_Result< GT >::embedding_rotation, Aleph::Array< T >::empty(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::Array< T >::get_last(), Aleph::Planarity_Test_Result< GT >::has_combinatorial_embedding, Aleph::Planar_Geometric_Drawing< GT >::has_embedding, Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Array< T >::is_empty(), Aleph::Planarity_Test_Result< GT >::is_planar, Aleph::Planar_Geometric_Drawing< GT >::Node_Position::node, Aleph::Planar_Geometric_Drawing< GT >::node_positions, Aleph::Planar_Geometric_Drawing< GT >::num_components, options, Aleph::planar_dual_metadata(), Aleph::Planar_Geometric_Drawing< GT >::relaxation_iterations, Aleph::Array< T >::remove_last(), Aleph::Array< T >::reserve(), Aleph::planarity_detail::segments_properly_intersect(), Aleph::Planarity_Test_Result< GT >::simplified_num_edges, Aleph::Planarity_Test_Result< GT >::simplified_num_nodes, Aleph::Array< T >::size(), Aleph::Planar_Geometric_Drawing< GT >::Node_Position::x, and Aleph::Planar_Geometric_Drawing< GT >::Node_Position::y.
Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().
| Planarity_Test_Result< GT > Aleph::planarity_test | ( | const GT & | g, |
| const Planarity_Test_Options & | options | ||
| ) |
Overload with default arc selector.
Definition at line 2892 of file Planarity_Test.H.
References options.
| Planarity_Test_Result< GT > Aleph::planarity_test | ( | const GT & | g, |
| SA | sa = SA(), |
||
| const Planarity_Test_Options & | options = Planarity_Test_Options() |
||
| ) |
Execute a comprehensive planarity test on an Aleph graph.
Performs the Left-Right planarity test on the underlying simple undirected representation of the graph. Depending on the options, it can also compute a planar embedding or a non-planarity witness.
| GT | Graph type. |
| SA | Arc filter type (default: show all arcs). |
| [in] | g | The input graph (can be directed or undirected). |
| [in] | sa | Arc filter instance. |
| [in] | options | Configuration for optional advanced outputs. |
Definition at line 2879 of file Planarity_Test.H.
References options, and Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::run().
Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
| size_t Aleph::rank_graphviz | ( | const GT & | g, |
| std::ostream & | out, | ||
| Node_Attr | node_attr = Node_Attr(), |
||
| Arc_Attr | arc_attr = Arc_Attr(), |
||
| const std::string & | rankdir = "LR", |
||
| SA | sa = SA() |
||
| ) |
Generate Graphviz DOT output with topological ranking.
Creates a DOT specification that groups nodes by their topological rank (level in DAG). Each rank is placed in a separate subgraph for visual grouping.
This is useful for visualizing DAGs where the vertical position should reflect dependencies.
| GT | Graph type (must be a DAG) |
| Node_Attr | Node attribute generator |
| Arc_Attr | Arc attribute generator |
| SN | Node filter |
| SA | Arc filter |
| g | Graph to visualize (should be a DAG) |
| out | Output stream |
| node_attr | Node attribute functor |
| arc_attr | Arc attribute functor |
| rankdir | Layout direction (default: "LR") |
| sa | the filter of the arcs, which each iterator copies, and the ranks are those of the arcs that it shows |
Definition at line 554 of file generate_graph.H.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), out, Aleph::ranks(), and Aleph::Q_Topological_Sort< GT, Itor, SA >::ranks().
Referenced by TEST(), and TYPED_TEST().
|
noexcept |
Arc filtered searching given two nodes.
This function receives two nodes and returns the first arc linking them. The arc sense is irrelevant for this function. Simply, it searches an arc linking the nodes
| [in] | g | the graph |
| [in] | src | a node |
| [in] | tgt | another node |
| [in] | sa | filtering condition |
nullptr otherwise | anything | that sa throws |
Definition at line 3574 of file tpl_graph.H.
References Aleph::and, GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and GTNodeCommon< NodeInfo >::num_arcs.
Referenced by Aleph::Path< GT >::append(), Aleph::Path< GT >::insert(), parse_arc_definition(), parse_arc_text_definition(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().
|
noexcept |
Searching of directed arc linking two nodes.
| [in] | g | the graph |
| [in] | src | source node pointer |
| [in] | tgt | target node pointer |
| [in] | sa | arc filter (default: Dft_Show_Arc) |
nullptr otherwise. | anything | that sa throws |
Definition at line 3603 of file tpl_graph.H.
References Aleph::and, and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by Aleph::Path< GT >::append_directed(), Aleph::Path< GT >::insert_directed(), TEST(), TEST(), and TEST_F().
|
inline |
Find or create a node by ID.
Searches for a node with the given ID in the graph. If not found, creates a new node with empty fields.
| g | The digraph to search. |
| s | The node ID to find. |
Definition at line 162 of file load_digraph.H.
References Aleph::search_node().
Referenced by Aleph::load_digraph(), Aleph::search_node(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Split a text into tokens using a separator set.
Tokenizes the input text by splitting on any character in the separators set. Empty tokens are not included.
| text | The text to split. |
| separators | String containing separator characters. |
| words | Output list to receive the tokens. |
Definition at line 115 of file load_digraph.H.
References Aleph::DynDlist< T >::append(), and Aleph::split().
|
inline |
Create a random Hamiltonian graph.
This version builds a random graph that is guaranteed to satisfy sufficient conditions for being Hamiltonian.
The process first generates a random graph, then examines the result and creates new arcs so that the output satisfies the Ore/Dirac theorems for Hamiltonian graphs.
__num_nodes increases.| [in] | __num_nodes | Number of nodes the graph should have. |
| [in] | p | Probability of an arc existing between any pair of nodes. Defaults to 0.5, which empirically tends to produce fewer arcs and consume less time. |
| bad_alloc | if there is not enough memory. |
| domain_error | if p is not in the range (0, 1]. |
Definition at line 401 of file random_graph.H.
References Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::create_p(), Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::g, and Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::make_hamiltonian().
Referenced by TEST().
|
inline |
Create a random Hamiltonian graph.
This version builds a random graph that is guaranteed to satisfy sufficient conditions for being Hamiltonian.
The process first generates a random graph, then examines the result and creates new arcs so that the output satisfies the Ore/Dirac theorems for Hamiltonian graphs.
__num_nodes increases.| [in] | __num_nodes | Number of nodes the graph should have. |
| [in] | p | Probability of an arc existing between any pair of nodes. Defaults to 0.5, which empirically tends to produce fewer arcs and consume less time. |
| bad_alloc | if there is not enough memory. |
| domain_error | if p is not in the range (0, 1]. |
Definition at line 982 of file random_graph.H.
References Aleph::Random_Graph< GT, Init_Node, Init_Arc >::create_p(), Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::g, and Aleph::Random_Graph< GT, Init_Node, Init_Arc >::make_hamiltonian().
Referenced by TEST().
|
inline |
Connectivity test for undirected graphs.
| [in] | g | Graph to test. |
true if g is connected; false otherwise.false for an empty graph. | domain_error | If g is a directed graph. |
Definition at line 720 of file tpl_graph_utils.H.
References ah_domain_error_if, GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::is_digraph(), and num_nodes.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
Search for a cycle reachable from a given node.
Performs a depth-first exploration starting at src and returns true if a cycle that returns to src is found.
Test_Cycle control bit on both nodes and arcs.| [in] | g | Graph to search. |
| [in] | src | Source node (must be non-null and belong to g). |
true if a cycle returning to src is found; false otherwise.Definition at line 758 of file tpl_graph_utils.H.
References Aleph::__test_cycle(), ah_invalid_argument_if, ARC_BITS, GraphCommon< GT, Node, Arc >::get_arc_it(), IS_ARC_VISITED, GraphCommon< GT, Node, Arc >::reset_bit_arcs(), GraphCommon< GT, Node, Arc >::reset_bit_nodes(), and Aleph::Test_Cycle.
Referenced by TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Return true if there is a path between two nodes.
Performs a depth-first reachability test from start_node to end_node.
Find_Path control bit on both nodes and arcs.| [in] | g | Graph to test. |
| [in] | start_node | Start node (must be non-null and belong to g). |
| [in] | end_node | End node (must be non-null and belong to g). |
true if end_node is reachable from start_node; false otherwise.Definition at line 1004 of file tpl_graph_utils.H.
References Aleph::__test_for_path(), ah_invalid_argument_if, ARC_BITS, Aleph::Find_Path, GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::reset_bit_arcs(), and GraphCommon< GT, Node, Arc >::reset_bit_nodes().
Referenced by TEST(), TEST(), and TYPED_TEST().
|
inlinenoexcept |
Return readable name for certificate type.
Definition at line 131 of file Planarity_Test.H.
References Aleph::K33_Subdivision, Aleph::K5_Subdivision, Aleph::Minimal_NonPlanar_Obstruction, and Aleph::None.
|
inline |
Generic arcs traverse of a node.
This template function receives threes template parameters:
GT: the graph type.Itor: the iterator type; it is intended to be _In_Iterator or _Out_Iterator.Operation: an operation to be executed on each arc. This operation must have the following signature:bool operation(typename GT::Arc * arc)
If operation returns true then the traversal continues to the next arc; otherwise the traversal stops and the result of traverse() is false. If all the arcs are traversed, then the result is true.
| [in] | p | node pointer |
| [in] | op | operation to be performed on each arc |
true if all the arcs were traversed: false otherwise Definition at line 2891 of file tpl_graph.H.
References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().
Referenced by TEST().
|
inline |
Conditioned traversal of the arcs of g into p.
On a digraph, which the function tells at run time, the arcs are looked for among those of the graph, in \(O(E)\); on a graph that is not directed, in the list of p.
| [in] | g | the graph of p |
| [in] | p | node pointer |
| [in] | op | operation whose result must be bool. If it is false, then the traversal stops and returns false |
true if all the arcs were traversed: false otherwise Definition at line 2970 of file tpl_graph.H.
References Aleph::all(), and Aleph::in_arcs_detail::traverse_arcs_into().
|
inline |
Conditioned traversal of incoming arcs of a node.
It does not compile on a digraph type: use traverse_in_arcs(g, p, op).
| [in] | p | node pointer |
| [in] | op | operation whose result must be bool. If the result is false, then the traversal stops and the traverse returns false; otherwise, all the arcs are traversed and it returns true |
true if all the arcs were traversed: false otherwise Definition at line 2947 of file tpl_graph.H.
Referenced by Aleph::all_in_arc(), Aleph::exists_in_arc(), Aleph::search_in_arc(), TYPED_TEST(), and TYPED_TEST().
|
inline |
Conditioned traversal of outcoming arcs of a node.
| [in] | p | node pointer |
| [in] | op | operation whose result must be bool. If the result is false, then the traversal stops and the traverse returns false; otherwise, all the arcs are traversed and it returns true |
true if all the arcs were traversed: false otherwise Definition at line 3373 of file tpl_graph.H.
| NonPlanar_Certificate_Validation< GT > Aleph::validate_nonplanar_certificate | ( | const Planarity_Test_Result< GT > & | result | ) |
Validate structural consistency of a non-planar certificate.
This function checks internal witness invariants (node/edge references, path chaining and obstruction/path coherence). It does not re-run planarity.
Definition at line 3944 of file Planarity_Test.H.
References Aleph::and, Aleph::Planarity_Test_Result< GT >::certificate_branch_nodes, Aleph::Planarity_Test_Result< GT >::certificate_obstruction_edges, Aleph::Planarity_Test_Result< GT >::certificate_paths, Aleph::Planarity_Test_Result< GT >::certificate_type, Aleph::planarity_detail::collect_certificate_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::NonPlanar_Certificate_Validation< GT >::duplicate_branch_nodes, Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::NonPlanar_Certificate_Validation< GT >::has_certificate, Aleph::Planarity_Test_Result< GT >::has_nonplanar_certificate, Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::NonPlanar_Certificate_Validation< GT >::is_valid, Aleph::K33_Subdivision, Aleph::K5_Subdivision, Aleph::NonPlanar_Certificate_Validation< GT >::kuratowski_shape_mismatch, nodes, Aleph::None, Aleph::NonPlanar_Certificate_Validation< GT >::null_branch_nodes, Aleph::NonPlanar_Certificate_Validation< GT >::null_obstruction_edge_endpoints, Aleph::NonPlanar_Certificate_Validation< GT >::null_path_edge_endpoints, Aleph::NonPlanar_Certificate_Validation< GT >::null_path_nodes, Aleph::NonPlanar_Certificate_Validation< GT >::num_branch_nodes, Aleph::NonPlanar_Certificate_Validation< GT >::num_nodes, Aleph::NonPlanar_Certificate_Validation< GT >::num_obstruction_edges, Aleph::NonPlanar_Certificate_Validation< GT >::num_paths, Aleph::NonPlanar_Certificate_Validation< GT >::path_edge_endpoint_mismatch, Aleph::NonPlanar_Certificate_Validation< GT >::path_edge_not_in_obstruction, Aleph::NonPlanar_Certificate_Validation< GT >::path_node_edge_length_mismatch, and Aleph::Array< T >::size().
Referenced by main(), Aleph::nonplanar_certificate_is_valid(), TEST(), and TEST().
| long Aleph::vertex_connectivity | ( | GT & | g, |
| SA | sa = SA() |
||
| ) |
Compute vertex connectivity of an undirected graph.
Uses a max-flow node-splitting reduction to compute the minimum number of vertices whose removal disconnects the graph.
The arc filter SA is applied when computing degrees, connectivity, and when building the auxiliary network.
Side effects:
Depth_First control bit on nodes and arcs to test connectivity.| GT | Graph type (undirected). |
| Max_Flow | Maximum flow functor. |
| SA | Arc filter functor. |
| [in,out] | g | Graph to analyze. |
| [in] | sa | the filter of the arcs, which each iterator copies. |
g (0 for empty or disconnected graphs). | std::domain_error | If g is a digraph. |
| std::bad_alloc | If there is not enough memory. |
Definition at line 506 of file tpl_kgraph.H.
References ah_domain_error_if, Aleph::and, Aleph::DynDlist< T >::append(), Aleph::Net_Graph< NodeT, ArcT >::connect_arc(), Aleph::Net_Graph< NodeT, ArcT >::disconnect_arc(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::DynDlist< T >::get(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Dlink::Iterator::has_curr(), Aleph::Digraph_Iterator< GT, Filter >::has_curr(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Dlink::is_empty(), k, Aleph::Filter_Iterator< Container, It, Show_Item >::next(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, num_nodes, and Aleph::Net_Graph< NodeT, ArcT >::reset().
| void Aleph::warshall_compute_transitive_clausure | ( | GT & | g, |
| Bit_Mat_Graph< GT, SA > & | mat, | ||
| SA | sa = SA() |
||
| ) |
Computes the transitive closure of a graph using Warshall's algorithm.
This function computes the transitive closure of graph g by means of Warshall's algorithm. The result is stored in the bit matrix mat.
Each entry mat(i,j) indicates whether there exists a path from the source node with index i to the destination node with index j. A value of 0 indicates there is no path; a value of 1 indicates there exists at least one path.
The procedure uses two bit matrices: an internal temporary one (freed when the procedure ends) and the output matrix mat.
| [in] | g | The graph represented by a List_Graph variant. |
| [out] | mat | Bit matrix where the result is stored. |
| [in] | sa | the filter of the arcs: the closure is that of the arcs that it shows. |
| std::bad_alloc | if there is not enough memory. |
Definition at line 84 of file warshall.H.
References Aleph::and, Aleph::Bit_Mat_Graph< GT, SA >::get_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::get_num_nodes(), k, and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), and TYPED_TEST().
| size_t Aleph::welsh_powell_coloring | ( | const GT & | g, |
| DynMapTree< typename GT::Node *, size_t > & | colors, | ||
| SA | sa = SA() |
||
| ) |
Welsh-Powell graph coloring.
Applies first-fit greedy coloring after sorting nodes in decreasing order of degree. Typically uses fewer colors than plain greedy but is still a heuristic.
| GT | Graph type (List_Graph, List_Digraph, Array_Graph, …). |
| SA | Arc-filter functor (defaults to Dft_Show_Arc<GT>). |
| [in] | g | Input graph. Must not contain self-loops. |
| [out] | colors | Output map from GT::Node* to 0-based color index. Cleared and overwritten on entry. |
| [in] | sa | The filter of the arcs, which each pass copies. |
| std::domain_error | if g contains a self-loop. |
g.NODE_COOKIE on every node; saved and restored via Cookie_Saver before the function returns. Definition at line 269 of file Graph_Coloring.H.
References Aleph::DynList< T >::append(), GraphCommon< GT, Node, Arc >::get_node_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::mergesort(), NODE_COOKIE, nodes, Aleph::DynSetTree< Key, Tree, Compare >::size(), Aleph::size(), and w.
Referenced by demo_algorithm_comparison(), demo_exam_scheduling(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| auto Aleph::with_clean_cookies | ( | GT & | g, |
| Func && | func | ||
| ) | -> decltype(func()) |
Convenience function to run an algorithm with automatic cookie cleanup.
Executes the given callable with automatic cookie cleanup on exit (whether normal return or exception).
| GT | Graph type. |
| Func | Callable type. |
| g | Graph to operate on. |
| func | Function/lambda to execute. |
Definition at line 492 of file cookie_guard.H.
Referenced by TEST_F().
| auto Aleph::with_saved_cookies | ( | GT & | g, |
| Func && | func | ||
| ) | -> decltype(func()) |
Convenience function to run an algorithm preserving existing cookies.
Executes the given callable, automatically saving cookies before and restoring them after (whether normal return or exception).
| GT | Graph type. |
| Func | Callable type. |
| g | Graph to operate on. |
| func | Function/lambda to execute. |
Definition at line 524 of file cookie_guard.H.
Referenced by TEST_F().
| void Aleph::write_df_low_tree | ( | const GT & | g, |
| typename GT::Node * | src, | ||
| std::ostream & | out, | ||
| Node_Label | node_label = Node_Label(), |
||
| SA | sa = SA() |
||
| ) |
Write, for ntreepic, the depth-first spanning tree of an undirected graph with the df and low numbers of its nodes.
Builds the tree with build_df_low_tree(), writes it with generate_tree() and Write, and then writes each arc that is not in the tree as Dashed-Connexion <descendant> <ancestor> L, with the Dewey numbers of its two ends in the tree, alternating L and R, so that ntreepic draws them as dashed curves on either side.
| Write | Writer of the label of each tree node: Write_Df_Tree_Low (label,df,low, the default), Write_Df_Tree_Df ((label,df)), Write_Df_Tree_Label (label) or one of the caller, with std::string operator () (Df_Low_Tree_Node *) |
| GT | Graph type; it must not be a digraph |
| Node_Label | Functor with std::string operator () (typename GT::Node *) that gives the label of each node |
| SA | Arc filter |
| [in] | g | The graph |
| [in] | src | The start node, the root of the tree |
| [out] | out | Stream where the picture is written |
| [in] | node_label | Label of each node |
| [in] | sa | Arc filter |
| std::domain_error | if g is a digraph |
| std::invalid_argument | if src is null |
| std::bad_alloc | if there is not enough memory |
On an exception, out may hold part of the picture.
Definition at line 500 of file generate_df_tree.H.
References Aleph::build_df_low_tree(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), LocateFunctions< Container, Type >::get_it(), Aleph::df_tree_detail::number_tree(), out, and root().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().
| DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > Aleph::yen_k_shortest_paths | ( | const GT & | g, |
| typename GT::Node * | source, | ||
| typename GT::Node * | target, | ||
| const size_t | k, | ||
| Distance | distance = Distance(), |
||
| SA | sa = SA() |
||
| ) |
Compute k shortest loopless paths using Yen's algorithm.
Returns up to k simple paths ordered by non-decreasing total cost. If fewer than k paths exist, all available paths are returned.
| GT | Graph type. |
| Distance | Arc cost accessor (Distance::Distance_Type required). |
| SA | Arc filter. |
| [in] | g | Graph. |
| [in] | source | Source node. |
| [in] | target | Target node. |
| [in] | k | Maximum number of paths to return. |
| [in] | distance | Arc cost accessor. |
| [in] | sa | Arc filter. |
DynList<K_Shortest_Path_Item<GT, Cost_Type>>.| domain_error | If `source` or `target` is null, or if negative weights are detected. |
| overflow_error | If the cost of one of the first k paths does not fit in Distance_Type. A path beyond the first k whose cost does not fit throws nothing. |
const_cast and Cookie_Saver that mutate node/arc cookies on the graph object passed as g. Concurrent access to the same graph from multiple threads will cause data races. Definition at line 973 of file K_Shortest_Paths.H.
References ah_domain_error_if, ah_overflow_error_if, Aleph::and, Aleph::Array< T >::append(), Aleph::DynList< T >::append(), Aleph::k_shortest_paths_detail::compose_candidate(), Aleph::k_shortest_paths_detail::contains_path(), Aleph::Array< T >::get_last(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::Array< T >::is_empty(), k, Aleph::Array< T >::remove_last(), Aleph::Array< T >::reserve(), Aleph::k_shortest_paths_detail::same_prefix_nodes(), Aleph::Array< T >::size(), Aleph::k_shortest_paths_detail::state_to_path(), and Aleph::k_shortest_paths_detail::validate_non_negative_weights().
Referenced by TEST().
|
inline |
Font size for the DOT output.
Definition at line 255 of file load_digraph.H.
Referenced by FlagReset::FlagReset(), FlagReset::~FlagReset(), Aleph::generate_dot_file(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexpr |
Whether a filter of type SA of the arcs of GT is copied, moved and called without exceptions: then an iterator that it filters, and a search through one, throw nothing.
Else what the filter throws goes out of them.
Definition at line 1043 of file tpl_graph.H.
|
inline |
If true, show only the node number, not the full label.
Definition at line 249 of file load_digraph.H.
Referenced by FlagReset::FlagReset(), FlagReset::~FlagReset(), Aleph::generate_dot_file(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
| const unsigned char Aleph::Processed = 2 |
The node or arc has already been processed.
Definition at line 39 of file aleph-graph.C.
Referenced by Aleph::Directed_Find_Path< GT, Itor, SA >::find(), and Aleph::Find_Aumenting_Path< Net, Q >::search().
| const unsigned char Aleph::Processing = 1 |
The node are being processed; probably it is inside a queue, stack or heap.
Definition at line 38 of file aleph-graph.C.
Referenced by Aleph::Directed_Find_Path< GT, Itor, SA >::find(), and Aleph::Find_Aumenting_Path< Net, Q >::search().
| const unsigned char Aleph::Unprocessed = 0 |
The node have not bees processed.
This must be the initial state before general processing
Definition at line 37 of file aleph-graph.C.
Referenced by Aleph::min_cut(), and Aleph::Find_Aumenting_Path< Net, Q >::search().
|
inline |
If true, use vertical layout (default).
Definition at line 258 of file load_digraph.H.
Referenced by Aleph::SegmentArrangement::operator()(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().
|
inline |
If true, set node shapes based on class field.
Definition at line 252 of file load_digraph.H.
Referenced by FlagReset::FlagReset(), FlagReset::~FlagReset(), Aleph::generate_dot_file(), TEST(), TEST(), TEST(), and TEST().
|
inline |
If true, include NES percentage in node labels.
Definition at line 246 of file load_digraph.H.
Referenced by FlagReset::FlagReset(), FlagReset::~FlagReset(), Aleph::generate_dot_file(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Configuration options for DOT file generation.
These variables control the appearance of the generated DOT output. They are inline variables to avoid ODR violations while maintaining the original API.
Definition at line 243 of file load_digraph.H.
Referenced by FlagReset::FlagReset(), FlagReset::~FlagReset(), Aleph::generate_dot_file(), TEST(), TEST(), TEST(), and TEST().