Files @ c039c549918d
Branch filter:

Location: AENC/switchchain/cpp/exports.hpp - annotation

Tom Bannink
Add start of triangle counting for powerlaws
#pragma once
#include <iostream>
#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;
}