33 lines
872 B
C
33 lines
872 B
C
//
|
|
// Created by Tiago Batista Cardoso on 2/23/2026.
|
|
//
|
|
|
|
#ifndef GRAPHE_STRUCTS_H
|
|
#define GRAPHE_STRUCTS_H
|
|
|
|
struct node_t {
|
|
int id; // node id
|
|
struct node_t *next; // next node
|
|
};
|
|
typedef struct node_t node_t;
|
|
|
|
struct graph_t {
|
|
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;
|
|
|
|
// structure-related functions
|
|
int has_edge(const graph_t *graph, int u, int v);
|
|
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, int seed);
|
|
void displayGraph(graph_t *graph);
|
|
void free_graph(graph_t *graph);
|
|
|
|
#endif // GRAPHE_STRUCTS_H
|