Reverting change that made path unpacking impossible

This commit is contained in:
Dennis Luxen 2010-08-25 09:33:41 +00:00
parent dc889cfe80
commit b3fded0725
3 changed files with 15 additions and 8 deletions

View File

@ -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 BINARYHEAP_H_INCLUDED
#define BINARYHEAP_H_INCLUDED
@ -91,17 +91,17 @@ private:
template< typename NodeID, typename Key >
class SparseStorage {
public:
SparseStorage( size_t size = 0 ) { }
Key &operator[]( NodeID node ) {
return nodes[node];
}
void Clear() {
nodes.clear();
}
private:
google::sparse_hash_map< NodeID, Key > nodes;
};
@ -184,6 +184,13 @@ 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;

View File

@ -253,7 +253,7 @@ private:
}
if ( distance > *targetDistance ) {
heapForward->Clear();
heapForward->DeleteAll();
return;
}
for ( int edge = _firstEdge[node], endEdges = _firstEdge[node + 1]; edge != endEdges; ++edge ) {

View File

@ -126,7 +126,7 @@ private:
}
}
if ( distance > *_upperbound ) {
_forwardHeap->Clear();
_forwardHeap->DeleteAll();
return;
}
for ( typename GraphT::EdgeIterator edge = _graph->BeginEdges( node ); edge < _graph->EndEdges(node); edge++ ) {
@ -184,7 +184,7 @@ private:
}
}
assert(smallestWeight != SPECIAL_EDGEID);
assert(smallestWeight != SPECIAL_EDGEID); //no edge found. This should not happen at all!
const EdgeData ed = _graph->GetEdgeData(smallestEdge);
if(ed.shortcut)