|
ADS
Algorithms and Data Structures
|
The graphs of ADS as graphs of Boost.Graph, beyond the book, compiled only with ADS_WITH_BOOST [see cmake/ADSBoost.cmake]: the specializations of boost::graph_traits and boost::property_map, and the free functions that the concepts of Boost.Graph ask for, so that its algorithms (breadth_first_search(), dijkstra_shortest_paths(), bellman_ford_shortest_paths(), strong_components(), topological_sort(), the maximum flows) run on an ADS graph with no copy. More...
Go to the source code of this file.
The graphs of ADS as graphs of Boost.Graph, beyond the book, compiled only with ADS_WITH_BOOST [see cmake/ADSBoost.cmake]: the specializations of boost::graph_traits and boost::property_map, and the free functions that the concepts of Boost.Graph ask for, so that its algorithms (breadth_first_search(), dijkstra_shortest_paths(), bellman_ford_shortest_paths(), strong_components(), topological_sort(), the maximum flows) run on an ADS graph with no copy.
StaticGraph and ArrayGraph, the two graphs in compressed rows, are an IncidenceGraph, an AdjacencyGraph, a VertexListGraph and an EdgeListGraph: an edge is the pair ( tail , place ), the place of the arc in the array of the rows, which is also its edge_index, stable since the graph is static; the out-arcs of \( u \) are the places of its row, the weight of an arc is read where it lies (edge_weight), and the vertex index is the name of the node. ListGraph and ObservedGraph on a ListGraph are an IncidenceGraph, an AdjacencyGraph and a VertexListGraph with the edge ( tail , head ), their weight looked up in \( O( \deg u ) \), and a MutableGraph: add_edge(), remove_edge(), add_vertex(), remove_vertex() and clear_vertex() are the operations of the graph, so that a program of Boost.Graph that edits an ObservedGraph sends the events of Observable.h to its observers. Since the names of the nodes of ADS are stable, a removed vertex keeps the names of the others (unlike the vertices of a boost::adjacency_list on vecS), and num_vertices() is bound(), the range of the names, so that the maps of Boost.Graph indexed by vertex_index have a place for every name.
Every ADS graph is seen as oriented (directed_tag): the orientation of an ADS graph is a flag at run time, and an unoriented graph has both arcs of each edge, which the oriented algorithms of Boost.Graph read correctly; the algorithms that ask for undirected_tag do not take it. The free functions are in the namespace of the graphs, where argument-dependent lookup finds them whatever the order of the includes, and only the traits are in namespace boost; a program must not specialize them again for the same graphs, which would break the one definition rule.