Graph Convolutional Branch and Bound v1.0.0
A TSP solver that combines a graph convolutional network with a 1-Tree branch-and-bound.
Loading...
Searching...
No Matches
fibonacci_heap.h
Go to the documentation of this file.
1
12#pragma once
13#include <stdlib.h>
14#include <stdio.h>
15#include <stddef.h>
16#include <string.h>
17#include <assert.h>
18#include <stdbool.h>
19#include <float.h>
20#include <math.h>
21#ifndef BRANCHANDBOUND1TREE_FIBONACCI_HEAP_H
22#define BRANCHANDBOUND1TREE_FIBONACCI_HEAP_H
23
24
26typedef struct OrdTreeNode {
27 unsigned short key;
28 double value;
30
33
36 unsigned short num_children;
37 bool marked;
38 bool is_root;
40
41
43typedef struct FibonacciHeap{
47 unsigned short num_nodes;
48 unsigned short num_trees;
50
51
53
57
58
60
65void create_node(OrdTreeNode * node, unsigned short key, double value);
66
67
69
73void insert_node(FibonacciHeap * heap, OrdTreeNode * node);
74
75
77
83void create_insert_node(FibonacciHeap * heap, OrdTreeNode * node, unsigned short key, double value);
84
85
87
93int extract_min(FibonacciHeap * heap);
94
95
97
105void decrease_value(FibonacciHeap * heap, OrdTreeNode * node, double new_value);
106
107
108#endif //BRANCHANDBOUND1TREE_FIBONACCI_HEAP_H
void insert_node(FibonacciHeap *heap, OrdTreeNode *node)
Insert a Node in the Fibonacci Heap.
void create_insert_node(FibonacciHeap *heap, OrdTreeNode *node, unsigned short key, double value)
A wrapper function to create a Node and insert it in the Fibonacci Heap.
int extract_min(FibonacciHeap *heap)
Extract the minimum Node from the Fibonacci Heap.
void create_fibonacci_heap(FibonacciHeap *heap)
Create an empty Fibonacci Heap.
void create_node(OrdTreeNode *node, unsigned short key, double value)
Create a Node with a given key and value.
void decrease_value(FibonacciHeap *heap, OrdTreeNode *node, double new_value)
Decrease the value of a Node in the Fibonacci Heap.
The Fibonacci Heap datastructure as collection of Heap-ordered Trees.
OrdTreeNode * min_root
The root of the Heap-ordered Tree with the minimum value.
OrdTreeNode * tail_tree_list
The root of the tail Tree in the Fibonacci Heap.
unsigned short num_trees
The number of Trees in the Heap.
OrdTreeNode * head_tree_list
The root of the head Tree in the Fibonacci Heap.
unsigned short num_nodes
The number of Nodes in the Heap.
A Heap-ordered Tree Node where the key of the parent is <= the key of its children.
struct OrdTreeNode * right_sibling
The right sibling of the Node.
bool marked
True if the Node has lost a child, false otherwise.
unsigned short num_children
The number of children of the Node.
struct OrdTreeNode * head_child_list
The head of the list of children of the Node.
struct OrdTreeNode * left_sibling
The left sibling of the Node.
unsigned short key
The key of the Node.
bool is_root
True if the Node is a root, false otherwise.
struct OrdTreeNode * parent
The parent of the Node.
double value
The value of the Node.
struct OrdTreeNode * tail_child_list
The tail of the list of children of the Node.