> An alternative approach would be to realise that vertices need to be > stored in a sequence that has quick membership testing, for instance a > dictionary {'v1': 0, 'v2':1} etc. Depending on the type of access, > perhaps you would also need to keep the thing as a sequence > ['v1','v2']. In magma, this data structure is an "indexed set". > Including an element adds it at the end, if it doesn't already exist > in the indexed set. Probably, deletion should follow list semantics. > > I don't know how easy it is to make such a data structure efficient > and what the memory penalty is for having both hashing and ordering.
http://docs.python.org/py3k/whatsnew/3.1.html#pep-372-ordered-dictionaries The reference implementation in the PEP(372) states "O(n)" for deletion of keys. -- 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