24 #ifndef vtkDijkstraGraphInternals_h
25 #define vtkDijkstraGraphInternals_h
70 unsigned int l = i * 2;
72 unsigned int r = i * 2 + 1;
77 if ( l <= this->HeapSize &&
78 ( this->CumulativeWeights[ this->Heap[l] ] <
79 this->CumulativeWeights[ this->Heap[i] ] ) )
88 if ( r <= this->HeapSize &&
89 ( this->CumulativeWeights[ this->Heap[ r ] ] <
90 this->CumulativeWeights[ this->Heap[ smallest ] ] ) )
97 int t = this->Heap[i];
99 this->Heap[ i ] = this->Heap[ smallest ];
102 this->HeapIndices[ this->Heap[i] ] = i;
105 this->Heap[ smallest ] = t;
106 this->HeapIndices[ t ] = smallest;
114 if ( this->HeapSize >= (this->Heap.size() - 1) )
120 int i = this->HeapSize;
123 this->CumulativeWeights[ this->Heap[i/2] ] >
124 this->CumulativeWeights[v] )
126 this->Heap[ i ] = this->Heap[i/2];
127 this->HeapIndices[ this->Heap[i] ] = i;
132 this->HeapIndices[ v ] = i;
137 if ( this->HeapSize == 0 )
142 int minv = this->Heap[ 1 ];
143 this->HeapIndices[ minv ] = -1;
145 this->Heap[ 1 ] = this->Heap[ this->HeapSize ];
146 this->HeapIndices[ this->Heap[1] ]= 1;
157 int i = this->HeapIndices[ v ];
158 if ( i < 1 || i > static_cast<int>(this->HeapSize) )
164 this->CumulativeWeights[ this->Heap[ i/2 ] ] >
165 this->CumulativeWeights[ v ] )
167 this->Heap[ i ] = this->Heap[i/2];
168 this->HeapIndices[ this->Heap[i] ] = i;
174 this->HeapIndices[ v ] = i;
184 this->Heap.resize( size + 1 );
185 this->HeapIndices.resize( size );
189 unsigned int HeapSize;
192 std::vector<int> Heap;
195 std::vector<int> HeapIndices;
void HeapInsert(const int &v)
std::vector< unsigned char > BlockedVertices
~vtkDijkstraGraphInternals()
std::vector< unsigned char > ClosedVertices
std::vector< double > CumulativeWeights
vtkDijkstraGraphInternals()
Helper class due to PIMPL excess.
void Heapify(const int &i)
std::vector< std::map< int, double > > Adjacency
void HeapDecreaseKey(const int &v)
void InitializeHeap(const int &size)
std::vector< int > Predecessors
std::vector< unsigned char > OpenVertices