<commit_before>//
// Created by henrique on 08/09/16.
//
#include "inc/bibliotecas.h"
#include "inc/structs.h"

extern lista *newLista();
extern grafo *newGrafo();
extern node *newNode(void*);
extern vertice *newVertice(char*);
extern aresta *newAresta(vertice*, vertice*);

int main(){
    grafo *g = newGrafo();

    g->addAresta(g, newNode(newAresta(newVertice("a"), newVertice("b"))));
    g->addAresta(g, newNode(newAresta(newVertice("b"), newVertice("c"))));
    g->addAresta(g, newNode(newAresta(newVertice("c"), newVertice("d"))));
    g->addAresta(g, newNode(newAresta(newVertice("d"), newVertice("a"))));

    aresta *aresta = newAresta(newVertice("a"), newVertice("d"));

    //Task 1-2
    printf("%d", g->existeCaminho(g, aresta));

    //Task 3
    printf("\n%d", g->existeCiclo(g, newVertice("a")));

    //Task 4
    g->exibeCaminhos(g, aresta);

    return 0;
}<commit_msg>Inclusão de exemplos cíclicos e áciclicos<commit_after>//
// Created by henrique on 08/09/16.
//
#include "inc/bibliotecas.h"
#include "inc/structs.h"

extern lista *newLista();
extern grafo *newGrafo();
extern node *newNode(void*);
extern vertice *newVertice(char*);
extern aresta *newAresta(vertice*, vertice*);

void exemploGrafoAciclico();
void exemploGrafoCiclico();

int main(){
    printf("1 equivale à VERDADEIRO; 2 equivale à FALSO\n\n");

    exemploGrafoAciclico();
    exemploGrafoCiclico();

    return 0;
}

void exemploGrafoAciclico(){
    printf("Grafo Aciclico\n");
    grafo *g = newGrafo();

    g->addAresta(g, newNode(newAresta(newVertice("1"), newVertice("2"))));
    g->addAresta(g, newNode(newAresta(newVertice("1"), newVertice("5"))));
    g->addAresta(g, newNode(newAresta(newVertice("1"), newVertice("4"))));
    g->addAresta(g, newNode(newAresta(newVertice("2"), newVertice("5"))));
    g->addAresta(g, newNode(newAresta(newVertice("3"), newVertice("6"))));
    g->addAresta(g, newNode(newAresta(newVertice("4"), newVertice("6"))));
    g->addAresta(g, newNode(newAresta(newVertice("4"), newVertice("7"))));
    g->addAresta(g, newNode(newAresta(newVertice("5"), newVertice("7"))));
    g->addAresta(g, newNode(newAresta(newVertice("6"), newVertice("8"))));
    g->addAresta(g, newNode(newAresta(newVertice("7"), newVertice("8"))));

    aresta *aresta = newAresta(newVertice("1"), newVertice("8"));

    //Task 1-2
    printf("%d", g->existeCaminho(g, aresta));

    //Task 3
    printf("\n%d", g->existeCiclo(g, newVertice("1")));

    //Task 4
    g->exibeCaminhos(g, aresta);
}

void exemploGrafoCiclico(){
    printf("Grafo Ciclico\n");
    grafo *g = newGrafo();

    g->addAresta(g, newNode(newAresta(newVertice("1"), newVertice("2"))));
    g->addAresta(g, newNode(newAresta(newVertice("2"), newVertice("1"))));
    g->addAresta(g, newNode(newAresta(newVertice("2"), newVertice("3"))));
    g->addAresta(g, newNode(newAresta(newVertice("2"), newVertice("5"))));
    g->addAresta(g, newNode(newAresta(newVertice("3"), newVertice("4"))));
    g->addAresta(g, newNode(newAresta(newVertice("4"), newVertice("2"))));
    g->addAresta(g, newNode(newAresta(newVertice("4"), newVertice("5"))));
    g->addAresta(g, newNode(newAresta(newVertice("4"), newVertice("6"))));

    aresta *aresta = newAresta(newVertice("1"), newVertice("2"));

    //Task 1-2
    printf("%d", g->existeCaminho(g, aresta));

    //Task 3
    printf("\n%d", g->existeCiclo(g, newVertice("5")));

    //Task 4
    g->exibeCaminhos(g, aresta);
}
{'fraction_non_alphanumeric': 0.21682188591385332, 'fraction_numerical': 0.02037252619324796, 'mean_word_length': 5.237749546279492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5035455', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1414, 'n_words': 216}