fibheap. [Perky]씨가 만든 FibonacciHeap [Python] 모듈 ([PythonCeeExtension])

http://fallin.lv/distfiles/fibheap-0.1.tar.gz

사용예제

   1 >>> import fibheap 
   2 >>> f = fibheap.fibheap() 
   3 >>> f[5] = 'merong' 
   4 >>> f[10] = 'hehe' 
   5 >>> f[15] = 'zzan~' 
   6 >>> dir(f) 
   7 ['__class__', '__cmp__', '__delattr__', '__delitem__', '__doc__', '__getattribute__', 
   8 '__getitem__', '__hash__', '__init__', '__len__', '__new__', '__reduce__', '__repr__', 
   9 '__setattr__', '__setitem__', '__str__', 'drop', 'has_key', 'peek', 'peekitem', 'pop', 
  10 'popitem'] 
  11 >>> f.peek() 
  12 'hehe' 
  13 >>> f.peekitem() 
  14 (10, 'hehe') 
  15 >>> f.popitem() 
  16 (10, 'hehe') 
  17 >>> f.popitem() 
  18 (5, 'merong') 
  19 >>> f.popitem() 
  20 (15, 'zzan~') 

value의 크기에 따라 처음부터 pop을 한다. [Python] 2.3부터는 PriorityQueue라는 모듈이 비슷하게 동작함

예제 : [Cluster.py]


CategoryProgramLibrary

web biohackers.net