Lines Matching defs:node

63 /* Create a new fibonacci heap node.  */
67 fibnode_t node;
69 node = (fibnode_t) xcalloc (1, sizeof *node);
70 node->left = node;
71 node->right = node;
73 return node;
101 fibnode_t node;
103 /* Create the new node. */
104 node = fibnode_new ();
106 /* Set the node's data. */
107 node->data = data;
108 node->key = key;
111 fibheap_ins_root (heap, node);
115 if (heap->min == NULL || node->key < heap->min->key)
116 heap->min = node;
120 return node;
123 /* Return the data of the minimum node (if we know it). */
133 /* Return the key of the minimum node (if we know it). */
177 /* Extract the data of the minimum node from HEAP. */
187 /* Otherwise, extract the min node, free the node, and return the
188 node's data. */
199 fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
209 if (fibheap_comp_data (heap, key, data, node) > 0)
212 odata = node->data;
213 okey = node->key;
214 node->data = data;
215 node->key = key;
216 y = node->parent;
222 of equality, a node we replaced the data on, becomes the new min. This
223 is needed so that delete's call to extractmin gets the right node. */
224 if (y != NULL && fibheap_compare (heap, node, y) <= 0)
226 fibheap_cut (heap, node, y);
230 if (fibheap_compare (heap, node, heap->min) <= 0)
231 heap->min = node;
238 fibheap_replace_data (fibheap_t heap, fibnode_t node, void *data)
240 return fibheap_replace_key_data (heap, node, node->key, data);
245 fibheap_replace_key (fibheap_t heap, fibnode_t node, fibheapkey_t key)
247 int okey = node->key;
248 fibheap_replace_key_data (heap, node, key, node->data);
254 fibheap_delete_node (fibheap_t heap, fibnode_t node)
256 void *ret = node->data;
259 fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
282 /* Extract the minimum node of the heap. */
289 /* Attach the child list of the minimum node to the root list of the heap.
320 fibheap_ins_root (fibheap_t heap, fibnode_t node)
322 /* If the heap is currently empty, the new node becomes the singleton
326 heap->root = node;
327 node->left = node;
328 node->right = node;
333 and it's right node. */
334 fibnode_insert_after (heap->root, node);
339 fibheap_rem_root (fibheap_t heap, fibnode_t node)
341 if (node->left == node)
344 heap->root = fibnode_remove (node);
397 fibnode_t node, fibnode_t parent)
400 parent->child = node;
402 fibnode_insert_before (parent->child, node);
403 node->parent = parent;
405 node->mark = 0;
410 fibheap_cut (fibheap_t heap, fibnode_t node, fibnode_t parent)
412 fibnode_remove (node);
414 fibheap_ins_root (heap, node);
415 node->parent = NULL;
416 node->mark = 0;
459 fibnode_remove (fibnode_t node)
463 if (node == node->left)
466 ret = node->left;
468 if (node->parent != NULL && node->parent->child == node)
469 node->parent->child = ret;
471 node->right->left = node->left;
472 node->left->right = node->right;
474 node->parent = NULL;
475 node->left = node;
476 node->right = node;