Skip to content

Pred dist fn#18

Merged
pratzl merged 2 commits intomainfrom
pred_dist_fn
Mar 26, 2026
Merged

Pred dist fn#18
pratzl merged 2 commits intomainfrom
pred_dist_fn

Conversation

@pratzl
Copy link
Collaborator

@pratzl pratzl commented Mar 25, 2026

Replace range with function parameters in algorithms for greater versatility.

pratzl added 2 commits March 25, 2026 16:54
…predecessor parameters

- Replace container-based distances[uid]/predecessor[uid] params with function-based
  distance(g, uid) and predecessor(g, uid) across dijkstra_shortest_paths,
  dijkstra_shortest_distances, bellman_ford_shortest_paths, bellman_ford_shortest_distances,
  and prim (via mst.hpp)
- Add new concepts to traversal_common.hpp: distance_function_for, predecessor_function_for,
  distance_fn_value_t type alias
- Add _null_predecessor_fn / _null_predecessor for skipping predecessor tracking without
  a null container, and is_null_predecessor_fn_v<T> trait
- Add container_value_fn<Container> CTAD function object adaptor bridging containers to the
  new function API (wraps c[uid] into fn(g, uid) -> auto&)
- Update all test call sites to use container_value_fn(distance) / container_value_fn(predecessor)
- Remove is_arithmetic_v<distance_fn_value_t<DistanceFn, G>> from all requires clauses;
  basic_edge_weight_function already constrains the arithmetic relationship via assignable_from
- Rename shortest_path_infinite_distance() -> infinite_distance()
- Rename shortest_path_zero() -> zero_distance()
- Rename concepts to use 'fn' consistently:
    distance_function_for  -> distance_fn_for
    predecessor_function_for -> predecessor_fn_for
    vertex_property_function_for -> vertex_property_fn_for
- Remove unused vertex_id_store_t alias and its static_asserts
- Update infinite_distance()/zero_distance() in dijkstra and
  bellman_ford docstrings and inline examples
- Update all docs (dijkstra.md, bellman_ford.md, mst.md,
  connected_components.md, label_propagation.md) to match
- Update graph_cpo.hpp comment for raw_vertex_id_t
@pratzl pratzl merged commit 0d574b1 into main Mar 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant