diff --git a/Contractor/BinaryHeap.h b/Contractor/BinaryHeap.h index e47bf8c89..e8599e9e3 100644 --- a/Contractor/BinaryHeap.h +++ b/Contractor/BinaryHeap.h @@ -125,6 +125,7 @@ public: heap.resize( 1 ); insertedNodes.clear(); heap[0].weight = 0; + nodeIndex.Clear(); } Key Size() const { @@ -183,13 +184,6 @@ public: return insertedNodes[removedIndex].node; } - void DeleteAll() { - for ( typename std::vector< HeapElement >::iterator i = heap.begin() + 1, iend = heap.end(); i != iend; ++i ) - insertedNodes[i->index].key = 0; - heap.resize( 1 ); - heap[0].weight = 0; - } - void DecreaseKey( NodeID node, Weight weight ) { const Key index = nodeIndex[node]; Key key = insertedNodes[index].key; diff --git a/Contractor/ContractionCleanup.h b/Contractor/ContractionCleanup.h index 515eedcf5..792136890 100644 --- a/Contractor/ContractionCleanup.h +++ b/Contractor/ContractionCleanup.h @@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. -*/ + */ #ifndef CONTRACTIONCLEANUP_H_INCLUDED #define CONTRACTIONCLEANUP_H_INCLUDED @@ -234,6 +234,9 @@ private: } cout << "Removed " << _graph.size() - usefull << " useless shortcuts" << endl; _graph.resize( usefull ); + for ( int threadNum = 0; threadNum < maxThreads; ++threadNum ) { + delete threadData[threadNum]; + } } template< class EdgeAllowed, class StallEdgeAllowed > void _ComputeStep( _Heap* heapForward, _Heap* heapBackward, const EdgeAllowed& edgeAllowed, const StallEdgeAllowed& stallEdgeAllowed, NodeID* middle, int* targetDistance ) { @@ -250,7 +253,7 @@ private: } if ( distance > *targetDistance ) { - heapForward->DeleteAll(); + heapForward->Clear(); return; } for ( int edge = _firstEdge[node], endEdges = _firstEdge[node + 1]; edge != endEdges; ++edge ) { diff --git a/Contractor/SearchEngine.h b/Contractor/SearchEngine.h index f8e27d265..b774cfd92 100644 --- a/Contractor/SearchEngine.h +++ b/Contractor/SearchEngine.h @@ -126,7 +126,7 @@ private: } } if ( distance > *_upperbound ) { - _forwardHeap->DeleteAll(); + _forwardHeap->Clear(); return; } for ( typename GraphT::EdgeIterator edge = _graph->BeginEdges( node ); edge < _graph->EndEdges(node); edge++ ) {