library/graph/ReverseGraph.hpp
- View this file on GitHub
- Last update: 2025-11-24 18:49:07+09:00
- Include:
#include "library/graph/ReverseGraph.hpp"
Depends on
Required by
Verified with
Code
#pragma once
template <typename GRAPH> GRAPH reverse_graph(const GRAPH &g) {
GRAPH r(g.n);
for (auto e : g.edges) {
std::swap(e.from, e.to);
r.add_arc(e);
}
r.build();
return r;
}#line 2 "library/graph/ReverseGraph.hpp"
template <typename GRAPH> GRAPH reverse_graph(const GRAPH &g) {
GRAPH r(g.n);
for (auto e : g.edges) {
std::swap(e.from, e.to);
r.add_arc(e);
}
r.build();
return r;
}