Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ExatoForcaBruta(Grafo* grafo, int* n_agentes, int cor) {
- //implementar
- //calcular tempo, salvar resultado do tempo em um log
- int fim = 1;
- int i,j;
- for(i = 0; i < (grafo)->n_vertices; i++){
- //for(j=0; j<grafo->n_vertices; j++) {
- if ((grafo)->cores[i] == -1) {
- (grafo)->cores[i] = 1;
- for(j=0; j<(grafo)->n_vertices; j++) {
- if((i!=j) && ((grafo)->arestas[i][j] != -1)){
- if((grafo)->cores[i] == (grafo)->cores[j]){
- (grafo)->cores[i] ++;
- if(cor < (grafo)->cores[i]){
- cor = (grafo)->cores[i];
- }
- j=0;
- }
- }
- }
- ExatoForcaBruta(grafo, n_agentes, cor);
- cor = 1;
- //(grafo)->cores[i] = 0;
- for(j=0; j<(grafo)->n_vertices; j++) {
- if( (grafo)->cores[j] > cor ) {
- cor = (grafo)->cores[j];
- }
- }
- fim = 0;
- }
- }
- if( fim ){
- if( (*n_agentes) > cor ){
- (*n_agentes) = cor;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement