algorithm

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub satashun/algorithm

:warning: cpp_src/graph/helper/RevGraph.hpp

Code

// ABC209E, ABC261H
template <class T>
Graph<T> rev_graph(const Graph<T>& g) {
    int n = g.size();
    Graph<T> rg(n);
    rep(i, n) {
        for (auto e : g[i]) {
            swap(e.from, e.to);
            rg[e.from].pb(e);
        }
    }
    return rg;
}
#line 1 "cpp_src/graph/helper/RevGraph.hpp"
// ABC209E, ABC261H
template <class T>
Graph<T> rev_graph(const Graph<T>& g) {
    int n = g.size();
    Graph<T> rg(n);
    rep(i, n) {
        for (auto e : g[i]) {
            swap(e.from, e.to);
            rg[e.from].pb(e);
        }
    }
    return rg;
}
Back to top page