#19348: edge_connectivity and vertex labels
-------------------------------------+-------------------------------------
       Reporter:  jmantysalo         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.9
      Component:  graph theory       |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Michele Borassi    |    Reviewers:  Vincent Delecroix
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/borassi/edge_connectivity_and_vertex_labels|  
7f3c0b9385b1c1353e04ffe8775eb7e546bac3c3
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:12 jmantysalo]:
 > Replying to [comment:11 borassi]:
 >
 > > > What is the point of making a dict to map `0, 1, 2, 3, ...` to
 Python objects? Use a list!
 > >
 > > I used a dict because (I think) lists are linked lists, and the random
 access time is O(n). Am I missing something?
 >
 > https://wiki.python.org/moin/TimeComplexity says that it is O(1).

 More precisely:
 - A python object is a `PyObject *`
 - A list or a tuple is a `PyObject **`
 - A set/dict is a hash table
 So you that you can not beat a Python list.

 On the other hand, if you want faster access to `my_list[i]` you can have
 a look at [http://docs.cython.org/src/reference/compilation.html#compiler-
 directives Cython  compiler directives].

--
Ticket URL: <http://trac.sagemath.org/ticket/19348#comment:21>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to