danielborowski / fibonacci-heap-python

Implementation of a Fibonacci heap in Python
MIT License
90 stars 37 forks source link

'NoneType' object has no attribute 'key' error in decrease_key #3

Open gracejenkins opened 6 years ago

gracejenkins commented 6 years ago

I'm using fibonacci heaps for a priority queue in a min cut algorithm. I've been able to successfully implement it with a couple of test graphs, but suddenly for one of my tests I'm getting this issue in decrease_key:

Traceback (most recent call last): File "TSPSolver.py", line 248, in main('test2.txt') File "TSPSolver.py", line 244, in main tsp = remove_subtours(tsp,G) File "TSPSolver.py", line 200, in remove_subtours constraint_edges, min_cut_nodes = find_subtour(G, model.X) File "TSPSolver.py", line 182, in find_subtour min_cut_nodes, min_cut_value = min_cut(G_x) File "TSPSolver.py", line 156, in min_cut cut_of_phase, cut_nodes, G = min_cut_phase(G) File "TSPSolver.py", line 144, in min_cut_phase to_search = update_fibheap(G,to_search, heap_nodes, a.value) File "TSPSolver.py", line 124, in update_fibheap fibheap.decrease_key(node,node.key - change_in_weight) File "/Users/ArluahsMAC/Desktop/CAAM471PTSD/fib_heap.py", line 76, in decrease_key if x.key < self.min_node.key: AttributeError: 'NoneType' object has no attribute 'key'

Any idea why this might be happening? Thanks!