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
mst.h
Go to the documentation of this file.
1
13#pragma once
14#ifndef BRANCHANDBOUND1TREE_MST_H
15#define BRANCHANDBOUND1TREE_MST_H
16#include "mfset.h"
17#include "fibonacci_heap.h"
18
19
21typedef struct ConstrainedEdge{
22 unsigned short src;
23 unsigned short dest;
25
26
28typedef struct MST{
29 bool isValid;
30 double cost;
31 double prob;
32 unsigned short num_nodes;
33 unsigned short num_edges;
34 Node nodes [MAX_VERTEX_NUM];
35 Edge edges [MAX_VERTEX_NUM];
36 short edges_matrix [MAX_VERTEX_NUM][MAX_VERTEX_NUM];
38
39
46void create_mst(MST* mst, const Node * nodes, unsigned short num_nodes);
47
48
54void add_edge(MST * tree, const Edge * edge);
55
56
61void print_mst(const MST * mst);
62
63
70void print_mst_original_weight(const MST * mst, const Graph * graph);
71
72
73#endif //BRANCHANDBOUND1TREE_MST_H
This file contains the declaration of the Fibonacci Heap datastructure for the Minimum Spanning Tree ...
This file contains the declaration of the Merge-Find Set datastructure for the Minimum Spanning Tree ...
void add_edge(MST *tree, const Edge *edge)
Add an Edge to the MST.
Definition: mst.c:38
void print_mst(const MST *mst)
Print the MST, printing all the information it contains.
Definition: mst.c:70
void create_mst(MST *mst, const Node *nodes, unsigned short num_nodes)
Create a Minimum Spanning Tree from a set of Nodes.
Definition: mst.c:17
void print_mst_original_weight(const MST *mst, const Graph *graph)
Print the MST, printing all the information it contains.
Definition: mst.c:92
A reduced form of an Edge in the Graph, with only the source and destination Nodes.
Definition: mst.h:21
unsigned short src
The source Node of the Edge.
Definition: mst.h:22
unsigned short dest
The destination Node of the Edge.
Definition: mst.h:23
Structure of an Edge.
Definition: graph.h:40
Structure of a Graph.
Definition: graph.h:51
Minimum Spanning Tree, or MST, and also a 1-Tree.
Definition: mst.h:28
unsigned short num_nodes
The number of Nodes in the MST.
Definition: mst.h:32
short edges_matrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]
-1 if there is no Edge between the two Nodes, otherwise the index of the Edge in the MST.
Definition: mst.h:36
double prob
The probability of the MST, i.e. the average of the probabilities of its Edges.
Definition: mst.h:31
Edge edges[MAX_VERTEX_NUM]
The set of Edges in the MST, these are |V| because the MST can be a 1-Tree.
Definition: mst.h:35
Node nodes[MAX_VERTEX_NUM]
The set of Nodes in the MST.
Definition: mst.h:34
unsigned short num_edges
The number of Edges in the MST.
Definition: mst.h:33
bool isValid
True if the MST has the correct number of Edges, false otherwise.
Definition: mst.h:29
double cost
The total cost of the MST, i.e. the sum of the weights of the Edges.
Definition: mst.h:30
Structure of a Node.
Definition: graph.h:30