Files @ 0f3a4ccb62ea
Branch filter:

Location: AENC/switchchain/cpp/exports.hpp

Tom Bannink
Add generation of random degree distribution and split cpp file
#pragma once
#include "graph.hpp"

std::ostream &operator<<(std::ostream &s, const Edge &e) {
    s << '{' << e.u << ',' << e.v << '}';
    return s;
}

// Mathematica style export
std::ostream &operator<<(std::ostream &s, const Graph &g) {
    if (g.edgeCount() == 0) {
        s << '{' << '}';
        return s;
    }
    s << '{' << g.getEdge(0).u << '<' << '-' << '>' << g.getEdge(0).v;
    for (unsigned int i = 1; i < g.edgeCount(); ++i) {
        const Edge &e = g.getEdge(i);
        s << ',' << e.u << '<' << '-' << '>' << e.v;
    }
    s << '}';
    return s;
}