> > "for i_id, i in enumerate(self.vertex_iterator())" would be in order. And
> > to obtain the id corresponding to v, I guess the best is to build a
> > dictionnary associating each vertex to its index at the beginning of the
> > algorithm.

Oh, sorry ! Beware when you write the reverse dictionary, for the
order of the vertices in vertex_iterator may not be the same as the
one returned by vertices() !!!

> Well, I "need" it for Tuesday.  ;-)  But not desperately.  Would the
> backends for graphs easily/efficiently support something like
> G.index(u)  to get the integer behind a vertex  u  quickly and
> easily?  It seems this would be useful for all the places where the
> code assumes vertices are integers (or at least ordered).

Well, they already do this at Cython level, but I guess they do it the
same way --> with a reverse dictionary. Recently I have spent some
time over the Graph backend and I guess I will have several patches to
write there... Especially because we now have iterators in Cython :-)

Nathann

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to