Exemplo n.º 1
0
void vtkPolyDataSingleSourceShortestPath::Relax(int u, int v, double w)
{
	if (this->d->GetValue(v) > this->d->GetValue(u) + w)
	{
		this->d->SetValue(v, this->d->GetValue(u) + w);
		this->pre->SetValue(v, u);
		
		HeapDecreaseKey(v);
	}
}
Exemplo n.º 2
0
int HeapDeleteIndex(Heap* ph, int index) {
  if(index >= ph->size || index < 0) return -1;
  ph->shif(ph->array[index],-1);
  ph->array[index]=ph->array[ph->size-1];
  ph->shif(ph->array[ph->size-1], index);
  ph->size--;
  HeapDecreaseKey(ph,index);
  HeapIncreaseKey(ph,index);
  HeapOdfouk(ph);
  return 1;
}
Exemplo n.º 3
0
int HeapPush(Heap* ph, void* item) {
  if(ph->size==ph->all) { //nafouknuti
    int newall = ((ph->all+1) << 1) - 1;
    ph->array = realloc(ph->array,newall*sizeof(void*));
    ph->all=newall;
  }
  ph->shif(item,ph->size);
  ph->array[ph->size]=item;
  ph->size++;
  HeapDecreaseKey(ph,ph->size-1);
  return 1;
}