-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphsGenerating.h
More file actions
72 lines (63 loc) · 1.74 KB
/
GraphsGenerating.h
File metadata and controls
72 lines (63 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @file GraphsGenerating.h
* @brief This file contains the declaration of the GraphsGenerating class and the slistEl struct.
*/
#ifndef GRAPHSGENERATING_H
#define GRAPHSGENERATING_H
/**
* @struct slistEl
* @brief Struct representing an element in a singly linked list.
* @var slistEl::v
* The vertex associated with this list element.
* @var slistEl::weight
* The weight of the edge associated with this list element.
* @var slistEl::next
* Pointer to the next element in the list.
*/
struct slistEl {
int v;
int weight;
slistEl* next;
};
/**
* @class GraphsGenerating
* @brief Class for generating and manipulating graphs.
* @var GraphsGenerating::incMatrix
* Incidence matrix of the graph.
* @var GraphsGenerating::numVertices
* Number of vertices in the graph.
* @var GraphsGenerating::numEdges
* Number of edges in the graph.
* @var GraphsGenerating::adjList
* Adjacency list of the graph.
*/
class GraphsGenerating {
public:
static int** incMatrix; // Incidence matrix
static int numVertices;
static int numEdges;
static slistEl** adjList;
/**
* @brief Loads a graph from a file.
*/
static void loadGraphFromFile();
/**
* @brief Prints the incidence matrix of the graph.
*/
static void printIncidenceMatrix();
/**
* @brief Prints the adjacency list of the graph.
*/
static void printAdjacencyList();
/**
* @brief Generates a random graph.
* @param vertices The number of vertices in the graph.
* @param density The density of the graph.
*/
static void generateRandomGraph(int vertices, int density);
/**
* @brief Frees the memory allocated for the graph.
*/
static void freeMemory();
};
#endif // GRAPHSGENERATING_H