diff --git a/D3128_Algorithms/src/visitor_edge.hpp b/D3128_Algorithms/src/visitor_edge.hpp index 8dedf95..76dd08e 100644 --- a/D3128_Algorithms/src/visitor_edge.hpp +++ b/D3128_Algorithms/src/visitor_edge.hpp @@ -1,25 +1,25 @@ template -concept has_on_examine_edge = // +concept has_on_examine_edge = // For exposition only requires(Visitor& v, edge_descriptor, true, edge_reference_t, void> edesc) { { v.on_examine_edge(edesc) }; }; template -concept has_on_edge_relaxed = // +concept has_on_edge_relaxed = // For exposition only requires(Visitor& v, edge_descriptor, true, edge_reference_t, void> edesc) { { v.on_edge_relaxed(edesc) }; }; template -concept has_on_edge_not_relaxed = // +concept has_on_edge_not_relaxed = // For exposition only requires(Visitor& v, edge_descriptor, true, edge_reference_t, void> edesc) { { v.on_edge_not_relaxed(edesc) }; }; template -concept has_on_edge_minimized = // +concept has_on_edge_minimized = // For exposition only requires(Visitor& v, edge_descriptor, true, edge_reference_t, void> edesc) { { v.on_edge_minimized(edesc) }; }; template -concept has_on_edge_not_minimized = +concept has_on_edge_not_minimized = // For exposition only requires(Visitor& v, edge_descriptor, true, edge_reference_t, void> edesc) { { v.on_edge_not_minimized(edesc) }; }; diff --git a/D3128_Algorithms/src/visitor_vertex.hpp b/D3128_Algorithms/src/visitor_vertex.hpp index d52f631..f2021dc 100644 --- a/D3128_Algorithms/src/visitor_vertex.hpp +++ b/D3128_Algorithms/src/visitor_vertex.hpp @@ -1,20 +1,20 @@ template -concept has_on_initialize_vertex = // +concept has_on_initialize_vertex = // For exposition only requires(Visitor& v, vertex_descriptor, vertex_reference_t, void> vdesc) { { v.on_initialize_vertex(vdesc) }; }; template -concept has_on_discover_vertex = // +concept has_on_discover_vertex = // For exposition only requires(Visitor& v, vertex_descriptor, vertex_reference_t, void> vdesc) { { v.on_discover_vertex(vdesc) }; }; template -concept has_on_examine_vertex = // +concept has_on_examine_vertex = // For exposition only requires(Visitor& v, vertex_descriptor, vertex_reference_t, void> vdesc) { { v.on_examine_vertex(vdesc) }; }; template -concept has_on_finish_vertex = // +concept has_on_finish_vertex = // For exposition only requires(Visitor& v, vertex_descriptor, vertex_reference_t, void> vdesc) { { v.on_finish_vertex(vdesc) }; }; diff --git a/D3128_Algorithms/tex/algorithms.tex b/D3128_Algorithms/tex/algorithms.tex index 6545b6a..c0c840c 100644 --- a/D3128_Algorithms/tex/algorithms.tex +++ b/D3128_Algorithms/tex/algorithms.tex @@ -409,7 +409,6 @@ \section{Shortest Paths} \phil{I assume \tcode{adjacency_list_graph} is the same as our \tcode{adjacency_list}. \tcode{bidirectional_adjacency_list_graph} is new; what to do with it?} \end{comment} - \subsection{Initialization} {\small @@ -461,6 +460,9 @@ \subsection{Dijkstra Shortest Paths and Shortest Distances} \subsubsection{Dijkstra Shortest Paths} +\phil{Feedback: use std::invocable instead of std::function to avoid performance penalty. + (Is this really an issue, when the function parameter has a default lambda?)} + \paragraph{Single-Source Shortest Paths} {\small \lstinputlisting{D3128_Algorithms/src/dijkstra_shortest_paths.hpp} diff --git a/D3129_Views/tex/revision.tex b/D3129_Views/tex/revision.tex index d7c05f4..fb7c806 100644 --- a/D3129_Views/tex/revision.tex +++ b/D3129_Views/tex/revision.tex @@ -14,3 +14,9 @@ \subsection*{\paperno r1} and to the \tcode{has_edge_value} concept if a \tcode{evf(uv)} function is passed. The same applies to all \textit{sourced} versions of the BFS, DFS and Topological Sort views. \end{itemize} + +\subsection*{\paperno r2} +\begin{itemize} + \item Restore the allocator parameters on the DFS, BFS and Toplogical Sort views, based on feedback and + by SG14/SG19 joint meeting. +\end{itemize} diff --git a/D3129_Views/tex/views.tex b/D3129_Views/tex/views.tex index 26a4a9d..8510c40 100644 --- a/D3129_Views/tex/views.tex +++ b/D3129_Views/tex/views.tex @@ -407,13 +407,11 @@ \subsection{Common Types and Functions for ``Search'' } \subsection{Depth First Search Views} -\phil{Add optional bitset enum event parameter, that match the visitor events.} - Depth First Search views iterate over the vertices and edges from a given seed vertex, returning a \tcode{vertex_descriptor} or \tcode{edge_descriptor} on each iteration when it is first encountered, depending on the function used. Table \ref{tab:dfs} shows the functions and their return values. -%While not shown in the examples, all functions have a final, optional allocator parameter that defaults to \tcode{std::allocator}. -%It is used for containers that are internal to the view. The \tcode{} argument has no particular meaning. +The \tcode{alloc} parameter shown in the following examples is optional and defaults to \tcode{std::allocator}. It is used for containers +that are internal to the view. The \tcode{bool} argument has no particular meaning. \tcode{vertices_dfs} views require a \tcode{vvf(u)} function, and the \tcode{basic_vertices_dfs} views require a \tcode{vvf(uid)} function. \tcode{edges_dfs} views require a \tcode{evf(uv)} function. \tcode{basic_sourced_edges_dfs} views require a \tcode{evf(eid)} function. @@ -422,9 +420,8 @@ \subsection{Depth First Search Views} % basic_edges_dfs(g,seed,evf) implies the use of Sourced type internally to have source_id in the call call to evf(eid) \phil{Consider adding an enum bitset of events matching the visitor events, and creating Overloads - that accept the bitset. Returned type would include the bitset event triggered, after the - value from the user-defined function. The returned value would be a class derived from - \tcode{vertex_descriptor} or \tcode{edge_descriptor}. This could offer a similar benefit as + that accept the bitset. The returned type would be a subclass of \tcode{vertex_descriptor} or \tcode{edge_descriptor} + and would add the event bitset as a final member value, with the bit set for the event . This could offer a similar benefit as coroutines.} \begin{table}[h!] @@ -434,23 +431,23 @@ \subsection{Depth First Search Views} \hline \textbf{Example} & \textbf{Return} \\ \hline - \tcode{for(auto\&\& [vid,v] : vertices_dfs(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,v,val] : vertices_dfs(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v] : vertices_dfs(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v,val] : vertices_dfs(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid,uv] : edges_dfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,uv,val] : edges_dfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv] : edges_dfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv,val] : edges_dfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hdashline - \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_dfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_dfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_dfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_dfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline - \tcode{for(auto\&\& [vid] : basic_vertices_dfs(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_vertices_dfs(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid] : basic_vertices_dfs(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_vertices_dfs(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid] : basic_edges_dfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_edges_dfs(g,seed,evf))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) + \tcode{for(auto\&\& [vid] : basic_edges_dfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_edges_dfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) \hdashline - \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_dfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_dfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_dfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_dfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline \end{tabular}} \caption{depth\_first\_search View Functions} @@ -461,13 +458,12 @@ \subsection{Depth First Search Views} \subsection{Breadth First Search Views} \phil{NetworkX provides an optional depth\_limit parameter for bfs. Add? } -\phil{Add optional bitset enum event parameter, that match the visitor events.} - Breadth First Search views iterate over the vertices and edges from a given seed vertex, returning a \tcode{vertex_descriptor} or \tcode{edge_descriptor} on each iteration when it is first encountered, depending on the function used. Table \ref{tab:bfs} shows the functions and their return values. -%While not shown in the examples, all functions have a final, optional allocator parameter that defaults to \tcode{std::allocator}. It is used for containers that are internal to the view. The \tcode{} argument has no particular meaning. +The \tcode{alloc} parameter shown in the following examples is optional and defaults to \tcode{std::allocator}. It is used for containers +that are internal to the view. The \tcode{bool} argument has no particular meaning. \tcode{vertices_bfs} views require a \tcode{vvf(u)} function, and the \tcode{basic_vertices_bfs} views require a \tcode{vvf(uid)} function. \tcode{edges_bfs} views require a \tcode{evf(uv)} function. @@ -478,9 +474,8 @@ \subsection{Breadth First Search Views} % basic_edges_bfs(g,seed,evf) implies the use of Sourced type internally to have source_id in the call call to evf(eid) \phil{Consider adding an enum bitset of events matching the visitor events, and creating Overloads - that accept the bitset. Returned type would include the bitset event triggered, after the - value from the user-defined function. The returned value would be a class derived from - \tcode{vertex_descriptor} or \tcode{edge_descriptor}. This could offer a similar benefit as + that accept the bitset. The returned type would be a subclass of \tcode{vertex_descriptor} or \tcode{edge_descriptor} + and would add the event bitset as a final member value, with the bit set for the event . This could offer a similar benefit as coroutines.} \begin{table}[h!] @@ -491,23 +486,23 @@ \subsection{Breadth First Search Views} \textbf{Example} & \textbf{Return} \\ \hline \hdashline - \tcode{for(auto\&\& [vid,v] : vertices_bfs(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,v,val] : vertices_bfs(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v] : vertices_bfs(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v,val] : vertices_bfs(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid,uv] : edges_bfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,uv,val] : edges_bfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv] : edges_bfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv,val] : edges_bfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hdashline - \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_bfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_bfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_bfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_bfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline - \tcode{for(auto\&\& [vid] : basic_vertices_bfs(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_vertices_bfs(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid] : basic_vertices_bfs(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_vertices_bfs(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid] : basic_edges_bfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_edges_bfs(g,seed,evf))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) + \tcode{for(auto\&\& [vid] : basic_edges_bfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_edges_bfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) \hdashline - \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_bfs(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_bfs(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_bfs(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_bfs(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline \end{tabular}} \caption{breadth\_first\_search View Functions} @@ -520,14 +515,18 @@ \subsection{Topological Sort Views} \tcode{edge_descriptor} on each iteration when it is first encountered, depending on the function used. Table \ref{tab:topo_sort} shows the functions and their return values. -%While not shown in the examples, all functions have a final, optional allocator parameter that defaults to \tcode{std::allocator}. It is used for containers that are internal to the view. The \tcode{} argument has no particular meaning. +The \tcode{alloc} parameter shown in the following examples is optional and defaults to \tcode{std::allocator}. It is used for containers +that are internal to the view. The \tcode{bool} argument has no particular meaning. \tcode{vertices_topological_sort} views require a \tcode{vvf(u)} function, and the \tcode{basic_vertices_topological_sort} views require a \tcode{vvf(uid)} function. \tcode{edges_topological_sort} views require a \tcode{evf(uv)} function. % basic_edges_topological_sort(g,seed,evf) implies the use of Sourced type internally to have source_id in the call call to evf(eid) -\phil{Consider adding a enum bitset similar to those for dfs and bfs.} +\phil{Consider adding an enum bitset of events matching the visitor events, and creating Overloads + that accept the bitset. The returned type would be a subclass of \tcode{vertex_descriptor} or \tcode{edge_descriptor} + and would add the event bitset as a final member value, with the bit set for the event . This could offer a similar benefit as + coroutines.} \begin{table}[h!] \begin{center} @@ -536,23 +535,23 @@ \subsection{Topological Sort Views} \hline \textbf{Example} & \textbf{Return} \\ \hline - \tcode{for(auto\&\& [vid,v] : vertices_topological_sort(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,v,val] : vertices_topological_sort(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v] : vertices_topological_sort(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,v,val] : vertices_topological_sort(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid,uv] : edges_topological_sort(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,uv,val] : edges_topological_sort(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv] : edges_topological_sort(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,uv,val] : edges_topological_sort(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hdashline - \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_topological_sort(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_topological_sort(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv] : sourced_edges_topological_sort(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,uv,val] : sourced_edges_topological_sort(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline - \tcode{for(auto\&\& [vid] : basic_vertices_topological_sort(g,seed))} & \tcode{vertex_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_vertices_topological_sort(g,seed,vvf))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid] : basic_vertices_topological_sort(g,seed,alloc))} & \tcode{vertex_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_vertices_topological_sort(g,seed,vvf,alloc))} & \tcode{vertex_descriptor} \\ \hdashline - \tcode{for(auto\&\& [vid] : basic_edges_topological_sort(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [vid,val] : basic_edges_topological_sort(g,seed,evf))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) + \tcode{for(auto\&\& [vid] : basic_edges_topological_sort(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [vid,val] : basic_edges_topological_sort(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ % requires source_ for evf(eid) \hdashline - \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_topological_sort(g,seed))} & \tcode{edge_descriptor} \\ - \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_topological_sort(g,seed,evf))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid] : basic_sourced_edges_topological_sort(g,seed,alloc))} & \tcode{edge_descriptor} \\ + \tcode{for(auto\&\& [uid,vid,val] : basic_sourced_edges_topological_sort(g,seed,evf,alloc))} & \tcode{edge_descriptor} \\ \hline \end{tabular}} \caption{topological\_sort View Functions} diff --git a/P1709r5.pdf b/P1709r5.pdf deleted file mode 100644 index 4db06a5..0000000 Binary files a/P1709r5.pdf and /dev/null differ