This commit is contained in:
Tiago Batista Cardoso
2026-02-24 17:50:39 +01:00
parent f804da7d88
commit 3928bee6c6
8 changed files with 1246 additions and 12 deletions

View File

@@ -6,16 +6,26 @@
#define GRAPHE_STRUCTS_H
struct node_t {
int id; // node id
struct node_t **neighbours; // node neighbours
int id; // node id
struct node_t *next; // next node
};
typedef struct node_t node_t;
struct graph_t {
int n; // number of nodes
int p; // probability that two nodes from the same group are linked
int q; // probability that two nodes from different groups are linked
int n; // number of vertices
double p; // probability that two nodes from the same group are linked
double q; // probability that two nodes from different groups are linked
node_t **adj_lists; // adjacent list
};
typedef struct graph_t graph_t;
#endif //GRAPHE_STRUCTS_H
// structure-related functions
node_t *create_node(int id);
graph_t *create_graph(int n, double p, double q);
void add_edge(graph_t *graph, int src, int dest);
graph_t *basic_graph();
graph_t *generate_graph(int n, double p, double q);
void displayGraph(graph_t *graph);
void free_graph(graph_t *graph);
#endif // GRAPHE_STRUCTS_H