[BGL] complexity of random_vertex/random_edge
http://www.boost.org/libs/graph/doc/random.html claims that random_vertex and random_edge both have a runtime complexity linear in the number of vertices and edges, respectively. This seems weird. Given a random access iterator and the number of elements, retrieving a random member should be doable in constant time. Is the complexity guarantee here based on the worst case of the lists only being directionally accessible? If yes, does using container class implementing the RandomAccessIterator concept automatically select constant-time versions of these random retrievers? Thanks for your comments. -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! spamtraps: madduck.bogus@madduck.net this product is under strict quality contril with perfect packing and quality when leving the factory.please keep away from damp.high temperature or sun expose.If found any detectives when purchasing. please return the productby airmail to our administration section and inform the time, place.and store of this purchase for our improvement.We shall give you a satisfactory reply.Thanks for your patronage and welcome your comments. -- http://www.engrish.com
On May 16, 2005, at 4:28 PM, martin f krafft wrote:
Given a random access iterator and the number of elements, retrieving a random member should be doable in constant time. Is the complexity guarantee here based on the worst case of the lists only being directionally accessible? If yes, does using container class implementing the RandomAccessIterator concept automatically select constant-time versions of these random retrievers?
They should be constant time for random access traversal iterators, but unfortunately they are not. I've logged this as a bug and will try to fix it after 1.33.0 is released. Doug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
also sprach Douglas Gregor
They should be constant time for random access traversal iterators, but unfortunately they are not. I've logged this as a bug and will try to fix it after 1.33.0 is released.
Rock on! - -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! spamtraps: madduck.bogus@madduck.net "sometimes we sit and read other people's interpretations of our lyrics and think, 'hey, that's pretty good.' if we liked it, we would keep our mouths shut and just accept the credit as if it was what we meant all along." -- john lennon -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCjMznIgvIgzMMSnURAqcRAJ0ReIw2N5BkQo2QubSdIV68LkokFwCfdMbo nKJ8XkDveVfkQw8umJypOMY= =Bfz2 -----END PGP SIGNATURE-----
participants (2)
-
Douglas Gregor
-
martin f krafft