graph-v2 icon indicating copy to clipboard operation
graph-v2 copied to clipboard

Should `vertex_id_t<G>` be default-constructible?

Open akrzemi1 opened this issue 5 months ago • 0 comments

Concept graph::adjacency_list does not require that vertex_id_t<G> be default-constructible. However, views::incidence (which is constrained with graph::adjacency_list) uses default construction: https://github.com/stdgraph/graph-v2/blob/master/include/graph/views/incidence.hpp#L83

This should be fixed in one or the other way:

  1. Add default-constructibility to the concept
  2. Use std::optional in the implementation instead of using a default-constructed value.

I personally do not like the idea of requiring default values. But if this would make the algorithm slightly faster, it is not a problem to come up with a default-constructed ID.

akrzemi1 avatar Jun 27 '25 20:06 akrzemi1