I am confused about the time complexity of the Boost Graph function vertex()
when operating on an adjacency_list
.
This page in the manual appears to claim that the function vertex()
runs in constant time even when template parameter VertexList
is listS
.
vertex()
This operation is constant time for vecS and for listS.
However, it is a mystery to me how the function can achieve constant time operation when the underlying data structure is a std::list
. I have looked at the generated object code and it looks like the function vertex()
compiles to an iterative loop when VertexList=listS
, versus a constant lookup when VertexList=vecS
.
Finally, I created a small test program which confirms that the run time scales with the value of the index passed to vertex()
when using listS
.
How does this add up?
Is there some special way to make vertex()
run in constant time, or did I misunderstand the documentation, or is the documentation simply wrong?