progress
This commit is contained in:
17
structs.c
17
structs.c
@@ -28,19 +28,6 @@ graph_t *create_graph(int n, double p, double q)
|
||||
return new_graph;
|
||||
}
|
||||
|
||||
//void add_edge(graph_t *graph, int src, int dest)
|
||||
//{
|
||||
// // src -> dest
|
||||
// node_t *new_node = create_node(dest);
|
||||
// new_node->next = graph->adj_lists[src];
|
||||
// graph->adj_lists[src] = new_node;
|
||||
//
|
||||
// // dest -> src
|
||||
// new_node = create_node(src);
|
||||
// new_node->next = graph->adj_lists[dest];
|
||||
// graph->adj_lists[dest] = new_node;
|
||||
//}
|
||||
|
||||
void add_edge(graph_t *graph, int src, int dest)
|
||||
{
|
||||
// Guard against self-loops and out-of-bounds
|
||||
@@ -89,7 +76,7 @@ graph_t *basic_graph()
|
||||
return basic;
|
||||
}
|
||||
|
||||
graph_t *generate_graph(int n, double p, double q)
|
||||
graph_t *generate_graph(int n, double p, double q, int seed)
|
||||
{
|
||||
clock_t start, end;
|
||||
double cpu_time_used;
|
||||
@@ -100,6 +87,8 @@ graph_t *generate_graph(int n, double p, double q)
|
||||
graph_t *result = create_graph(n, p, q);
|
||||
int remaining = n;
|
||||
|
||||
srand(seed);
|
||||
|
||||
// Calcul des repartitions aleatoires
|
||||
int n1 = rand() % (remaining + 1);
|
||||
remaining -= n1;
|
||||
|
||||
Reference in New Issue
Block a user