<commit_before>package nl.tudelft.ti2306.blockchain;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

import nl.tudelft.ti2306.blockchain.datastructure.PeerGraph;

public class PeerGraphToViz implements Runnable {

    private PeerGraph graph;
    private String output;

    public PeerGraphToViz(PeerGraph graph, String output) {
        this.graph = graph;
        this.output = output;
    }

    @Override
    public void run() {
        try (PrintWriter out = new PrintWriter(new File(output))) {
            out.println("graph peergraph {");
            out.println("ratio=expand;");
            out.println("node[width=.40,height=.40, label=\"\"]");
            out.println("edge[arrowsize=\"0.3\"]");
            for (int i = 0; i < graph.getNodes().size(); i++) {
                out.println(i + " [label=" + i + " style=filled fillcolor=red]");
                for (int j = 0; j < graph.getEdges(i).size(); j++) {
                    int k = graph.getEdges(i).get(j);
                    if (i > k) continue;
                    out.println(i + "--" + k + " [color=black]");
                }
            }
            out.println("}");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

}<commit_msg>Add colors to peer graph<commit_after>package nl.tudelft.ti2306.blockchain;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

import nl.tudelft.ti2306.blockchain.datastructure.PeerGraph;

public class PeerGraphToViz implements Runnable {

    private PeerGraph graph;
    private String output;

    public PeerGraphToViz(PeerGraph graph, String output) {
        this.graph = graph;
        this.output = output;
    }

    @Override
    public void run() {
        try (PrintWriter out = new PrintWriter(new File(output))) {
            out.println("graph peergraph {");
            out.println("ratio=expand;");
            out.println("node[width=.40,height=.40, label=\"\"]");
            out.println("edge[arrowsize=\"0.3\"]");
            for (int i = 0; i < graph.getNodes().size(); i++) {
                double hue = i / (double) graph.getNodes().size();
                out.println(i + " [label=" + i + " style=filled fillcolor=\"" + hue + " 1.0 1.0\"]");
                for (int j = 0; j < graph.getEdges(i).size(); j++) {
                    int k = graph.getEdges(i).get(j);
                    if (i > k) continue;
                    out.println(i + "--" + k + " [color=black]");
                }
            }
            out.println("}");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

}
{'fraction_non_alphanumeric': 0.14918154761904762, 'fraction_numerical': 0.013392857142857142, 'mean_word_length': 1.9778516057585824, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1371490', 'n_tokens_mistral': 850, 'n_tokens_neox': 803, 'n_words': 172}