ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
graph Directory Reference

Files

 
AllPairsShortestPaths.h
 The shortest paths between all the pairs of nodes, section 13.5: with the nodes \( v_0 , \ldots , v_{n-1} \), a path is \( k \)-bound if it passes through no node of { v_k , ... , v_{n-1} } but its ends, and the least cost of the k-bound paths from u to v is.
 
ArrayGraph.h
 The static GRAPH with vectors of adjacency of section 9.4 [see Graph.h]: the adjacent nodes of all the nodes in one vector, the ones of \( u \) in the places \( [ \mathrm{off}( u ) , \mathrm{off}( u + 1 ) ) \); no insertion nor deletion, \( \Theta( n + m ) \) space and no pointer.
 
Assignment.h
 The assignment problem, beyond the book: given the costs \( c( i , j ) \) of \( n \) rows and \( n \) columns (the workers and the tasks, the left and the right side of a complete bipartite graph), a perfect matching of the rows to the columns of least total cost, a cost infinity() [see ShortestPaths.h] forbidding its pair.
 
BlossomMatching.h
 The matchings of a general graph by the blossoms of Edmonds, beyond the book, whose matchings of a bipartite graph and branch and bound are in Matching.h [see Matching.h, which includes this header]:
 
EulerianCycle.h
 The Eulerian cycles and trails of a graph, oriented or not: a trail is a path that uses each edge exactly once, a cycle a closed trail.
 
FlowApplications.h
 Two uses of the maximum flow of section 15.2 [see MaxFlow.h]:
 
Graph.h
 The GRAPH of chapter 9 and its realizations.
 
GraphBuilder.h
 The step from a graph built one edge at a time to the static GRAPHs in compressed rows, beyond the book [see StaticGraph.h and ArrayGraph.h]: a GraphBuilder collects the nodes and the weighted edges as they come, with no row to keep, and freezes them into a StaticGraph or an ArrayGraph in \( \Theta( n + a ) \) time, \( a \) the number of arcs, by the counting sort by tail of their constructors.
 
Grid.h
 The visits of a GRID, the implicit graph whose nodes are the cells \( ( r , c ) \) of a \( \mathit{rows} \times \mathit{cols} \) matrix and whose edges are the moves from a cell to the cells at the given differences \( ( \mathit{dr} , \mathit{dc} ) \) that are inside the matrix and free: FOUR_MOVES (the four sides of a cell), EIGHT_MOVES (the sides and the corners, the king) and KNIGHT_MOVES (the knight).
 
GridGraph.h
 The graph of a grid map, beyond the book [see Graph.h and Grid.h]: the cells of a \( \mathit{rows} \times \mathit{cols} \) map, the cell \( ( r , c ) \) the node \( u = r \cdot \mathit{cols} + c \), each cell free or blocked, and the moves to the four sides of a cell or also to its four corners.
 
IncidenceGraph.h
 The oriented graph on its matrix of incidence, exercise 12.2 of Morin's book, beyond the book: the \( n \times m \) matrix \( A \) with \( A_{i,j} = -1 \) if the node \( i \) is the source of the edge \( j \), \( +1 \) if it is its target, and 0 otherwise, a GRAPH [see Graph.h] whose nodes are \( 0 , \ldots , n - 1 \), on which the visits of Visit.h run as on the others.
 
ListGraph.h
 The GRAPH with lists of adjacency of section 9.4 [see Graph.h]: for each node the LIST of its adjacent nodes and of the weights of the edges, \( \Theta( n + m ) \) space, adj( u ) in \( \Theta( |\mathrm{adj}( u )| ) \), hasEdge( u , v ) in \( O( |\mathrm{adj}( u )| ) \), all the edges in \( \Theta( n + m ) \), deleteNode() in \( O( n + m ) \).
 
Matching.h
 Matchings, the sets of edges of a graph no two of which share an end beyond the capacities of the ends:
 
MatrixGraph.h
 The GRAPH with an adjacency matrix of section 9.3 [see Graph.h]: the weight of \( ( u , v ) \), or nothing, the infinity of the book, in place \( ( u , v ) \); \( \Theta( n^2 ) \) space, hasEdge() in \( O( 1 ) \), adj( u ) in \( \Theta( n ) \), insertNode() and deleteNode() in \( \Theta( n ) \).
 
MaxFlow.h
 The maximum flow of section 15.2 in a network \( G = ( V , E , s , t , c ) \), with integer capacities, and the minimum cut.
 
MinimumSpanningTree.h
 The minimum spanning tree of an unoriented connected graph with weights on the edges (section 14.3): a tree on all the nodes, of \( n - 1 \) edges, of least total weight.
 
Observable.h
 A GRAPH that tells its changes, beyond the book: the wrapper Observable< G , O... > routes the changes of a graph of any model (ListGraph and MatrixGraph, and the weights of ArrayGraph and StaticGraph) and turns each of them into an event, a value of the std::variant GraphEvent< W >, which it sends to the observers that want its kind (see Changes of the graph and reoptimization):
 
Paths.h
 Problems on the paths of a GRAPH solved by the visits of section 9.5 and by the topological order, each in \( O( n + m ) \) time on lists or vectors of adjacency unless said otherwise:
 
PointerGraph.h
 An oriented graph with pointers, beyond the book: each node is an object with its label, a flag for the visits, the number of edges that touch it and the list of its edges, each a pointer to the other end and a weight.
 
Properties.h
 Properties of a GRAPH and of its trees, decided or measured by the visits of section 9.5:
 
PushRelabel.h
 The push-relabel of Goldberg and Tarjan, the way PUSH_RELABEL of FlowNetwork::maxFlow() [see MaxFlow.h], beyond the book: it keeps a preflow (more flow may enter a node than leave it) and labels that bound the distances from \( t \), with the node of the highest label discharged first, \( O( n^2 \sqrt{m} ) \) (Cheriyan and Maheshwari), and the global relabelings and the gaps of Cherkassky and Goldberg, on which its speed depends in practice (see Flows, cuts and matchings).
 
Reoptimization.h
 The solutions that follow the changes of a graph, beyond the book: the observers of an Observable [see Observable.h] that keep the tree of the shortest paths from a node, the minimum spanning forest and the maximum flow between two nodes, each together with a certificate of its optimality, so that after a change they can often prove at once that the solution is still optimal, and otherwise repair it or compute it again by the algorithms of the book [see ShortestPaths.h, MinimumSpanningTree.h, MaxFlow.h].
 
ShortestPaths.h
 The shortest paths of chapter 11 from a node \( r \) of an oriented GRAPH whose edges have a cost \( w( u , v ) \) [see Graph.h].
 
StaticGraph.h
 A static GRAPH for the engineered algorithms, beyond the book [see Graph.h]: the compressed sparse rows of ArrayGraph [see ArrayGraph.h] (the format CSR of the sparse matrices), with the arcs of each node sorted by head, which makes the reads of the visits that follow them go forward in memory.
 
StrongComponents.h
 The strongly connected components of an oriented graph by one visit in depth, beyond the book, whose visits and components by the algorithm of Kosaraju are in Visit.h [see Visit.h, which includes this header]:
 
Visit.h
 The visits of a GRAPH of section 9.5 and their applications, each in \( \Theta( n + m ) \) time on lists or vectors of adjacency: