Replies: 3 comments 1 reply
-
A couple of thoughts regarding the non-index adjacency list, that is, the situation where One. I can see that there already is a CPO Two. Is the case where |
Beta Was this translation helpful? Give feedback.
-
On defining concepts in terms of CPOs. One. When we see a constraint like requires(G&& g, vertex_id_t<G> uid) {
{ edges(g, uid) } -> forward_range;
} it is not clear if the constraint is on the CPO, or the function (the customization) provided by the author of Two. The implied requirements on CPOs -- in the form of using types like |
Beta Was this translation helpful? Give feedback.
-
I think I can now better articulate my observation. I believe that "random access range of forward ranges" may not be the best way to describe the adjacency list. I think a more accurate model would be: a forward range (of vertices) of forward ranges (of edges) with the ability to perform the look-up back into the outer collection of vertices. You need the forward iteration of vertices to count them or to apply something for each vertex (like initialization). And then, once you have found the id of the target vertex, to look it up in the collection of vertices. A random-access range happens to provide both these functions (forward iteration and efficient lookup), but in general you do not need the full power of a random-accees range. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to start the discussion on changing the concepts a bit. The current one (
index_adjacency_list
) is buggy and somewhat unfriendly to users. But rather than patching individual bugs, I would go with some principal approach.The things that I consider in need of fixing:
One. If a concept is defined in terms of CPOs, the defining CPOs require a more clear specification. We have to know which of the many CPOs are crucial for the definition of the concepts, and which are just optimization.
Two. Too many concepts.
Three. A hole in
index_adjacency_list
. It requires thattarget_id
returns something copyable (thecopyable
requirement is concealed inside the CPO), but nothing more. Whereas viewbfs_base
apparently requires that the result oftarget_id
is convertible tovertex_id_t<G>
(see here). As a result, I can customize my graph, so that it satisfies conceptindex_adjacency_list
, but any algorithm using my type fails to compile (see bad_type_that_satisfies_the_concept.cpp.txt).Four. Unnecessary two concepts: one for accessing vertices by index, the other for looking up vertices as if in a map. They can be merged by providing another CPO:
get_vertex(g, vid)
that will perform the look-up in a way most appropriate for the user graph.Beta Was this translation helpful? Give feedback.
All reactions