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
mfset.h
Go to the documentation of this file.
1
13#ifndef BRANCHANDBOUND1TREE_MFSET_H
14#define BRANCHANDBOUND1TREE_MFSET_H
15#include "graph.h"
16
17
19typedef struct Set {
20 struct Set * parentSet;
21 unsigned short rango;
23 unsigned short num_in_forest;
25
26
28typedef struct Forest {
29 unsigned short num_sets;
30 Set sets [MAX_VERTEX_NUM];
32
33
40void create_forest(Forest * forest, const Node * nodes, unsigned short num_nodes);
41
42
51void create_forest_constrained(Forest * forest, const Node * nodes, unsigned short num_nodes, unsigned short candidateId);
52
53
60void merge(Set * set1, Set * set2);
61
62
69Set* find(Set * set);
70
71
76void print_forest(const Forest * forest);
77
78
79#endif //BRANCHANDBOUND1TREE_MFSET_H
The data structures to model the Graph.
void merge(Set *set1, Set *set2)
Merge two Sets in the Forest if they are not already in the same Set.
Definition: mfset.c:53
Set * find(Set *set)
Find the root of a Set.
Definition: mfset.c:44
void create_forest(Forest *forest, const Node *nodes, unsigned short num_nodes)
Create a new Forest with n Sets, each Set containing a Node, without constraints.
Definition: mfset.c:31
void create_forest_constrained(Forest *forest, const Node *nodes, unsigned short num_nodes, unsigned short candidateId)
Create a new Forest with n Sets, each Set containing a Node, with constraints.
Definition: mfset.c:17
void print_forest(const Forest *forest)
Print all the Forest.
Definition: mfset.c:72
A Forest is a list of Sets.
Definition: mfset.h:28
Set sets[MAX_VERTEX_NUM]
Array of Sets.
Definition: mfset.h:30
unsigned short num_sets
Number of Sets in the Forest.
Definition: mfset.h:29
Structure of a Node.
Definition: graph.h:30
A Set is a node in the Forest.
Definition: mfset.h:19
struct Set * parentSet
Pointer to the parent Set in a tree representation of the Forest.
Definition: mfset.h:20
Node curr
Current Node.
Definition: mfset.h:22
unsigned short num_in_forest
Number of the position of the Set in the Forest.
Definition: mfset.h:23
unsigned short rango
Rank of the Set, used to optimize the find operation.
Definition: mfset.h:21