forked from sofia-bobbiesi/Lab_Discreta_II_2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain1.c
43 lines (36 loc) · 1.07 KB
/
main1.c
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
#include "UnleashHell.h"
#include "auxiliares.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main1() {
Grafo graph = ConstruccionDelGrafo();
// Greedy(graph);
// u32 perm[4] = {3,2,0,1};
// OrdenPorBloqueDeColores(graph,perm);
// imprimir_grafo(graph);
char bip_check1 = Bipartito(graph);
OrdenNatural(graph);
u32 coloreo = NumeroDeVertices(graph);
u32 mejor_coloreo = coloreo;
for (int i = 0; i < 1000; i++){
AleatorizarVertices(graph,i);
coloreo = Greedy(graph);
if (coloreo < mejor_coloreo){
mejor_coloreo = coloreo;
}
}
printf("El mejor coloreo con greedy fue de %u colores.\n",mejor_coloreo);
char bip_check2 = Bipartito(graph);
if (bip_check2 != bip_check1){
printf("Hubo un error al hacer bipartito.");
}
else if (bip_check1 == 1 && bip_check2 == 1){
printf("El grafo es bipartito.");
}
else if (bip_check1 == 0 && bip_check2 == 0){
printf("El grafo no es bipartito.");
}
DestruccionDelGrafo(graph);
return 0;
}