<commit_before>#include "io.hpp"

//////////////
// Includes //
#include <iostream>
#include <fstream>

#include "graph.hpp"

//////////
// Code //

// Loading a graph from a file.
Graph* loadGraph(std::string path) {
    // TODO: load the graph.
    return 0;
}

// Saving a graph to the file system.
int saveGraph(std::string path, Graph* g) {
    // TODO: Save the graph.
    return 0;
}

// Writing a graph to std out.
int coutGraph(Graph* g) {
    for (int i = 0; i < g->getLength(); i++) {<commit_msg>Added saving the graph to the file system.<commit_after>#include "io.hpp"

//////////////
// Includes //
#include <iostream>
#include <fstream>

#include "graph.hpp"

//////////
// Code //

// Loading a graph from a file.
Graph* loadGraph(std::string path) {
    // TODO: load the graph.
    return 0;
}

// Saving a graph to the file system.
int saveGraph(std::string path, Graph* g) {
    std::ofstream out;
    out.open(path);

    if (!out.good())
        return -1;

    out << g->getLength() << "\n";

    out << "NAMES\n";
    for (int i = 0; i < g->getLength(); i++)
        out << i << " " << g->getName(i) << "\n";

    out << "CONNS\n";
    for (int i = 0; i < g->getLength(); i++)
        for (int j = 0; j < g->getLength(); j++)
            if (g->areConnected(i, j))
                out << i << " " << j << "\n";

    return 0;
}

// Writing a graph to std out.
int coutGraph(Graph* g) {
    for (int i = 0; i < g->getLength(); i++) {
{'fraction_non_alphanumeric': 0.21374570446735394, 'fraction_numerical': 0.006872852233676976, 'mean_word_length': 2.071729957805907, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 15, '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': '6012734', 'n_tokens_mistral': 526, 'n_tokens_neox': 508, 'n_words': 167}