-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphGenerator.cpp
More file actions
27 lines (24 loc) · 786 Bytes
/
Copy pathGraphGenerator.cpp
File metadata and controls
27 lines (24 loc) · 786 Bytes
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
//
// Created by ingambe on 29/05/18.
//
#include "GraphGenerator.h"
#include "Graphes/Graphe_Liste.h"
#include "Graphes/Graphe_Adjacence.h"
Graphe *GraphGenerator::genererGrapheListe(int nb_lien) {
Graphe * graphe = new Graphe_Liste(NB_NOEUD);
for(int noeud = 0; noeud < NB_NOEUD; noeud++){
for(int i = 0; i < nb_lien / NB_NOEUD; i++){
graphe->ajouterLien(noeud, (noeud + 1 + i) % NB_NOEUD);
}
}
return graphe;
}
Graphe *GraphGenerator::genererGrapheAdjacence(int nb_lien) {
Graphe * graphe = new Graphe_Adjacence(NB_NOEUD);
for(int noeud = 0; noeud < NB_NOEUD; noeud++){
for(int i = 0; i < nb_lien / NB_NOEUD; i++){
graphe->ajouterLien(noeud, (noeud + 1 + i) % NB_NOEUD);
}
}
return graphe;
}