library

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

View the Project on GitHub shibh308/library

:warning: lib/functions/simple_graph.cpp

Code

template <typename T = pair<int,int>>
vector<vector<int>> simple_graph(vector<vector<T>>& edges, function<int(T)> f = [](auto x){return x.first;}){
    vector<vector<int>> simple_edges(edges.size());
    for(int i = 0; i < edges.size(); ++i)
        for(auto& x : edges[i])
            simple_edges[i].push_back(f(x));
    return simple_edges;
}
#line 1 "lib/functions/simple_graph.cpp"
template <typename T = pair<int,int>>
vector<vector<int>> simple_graph(vector<vector<T>>& edges, function<int(T)> f = [](auto x){return x.first;}){
    vector<vector<int>> simple_edges(edges.size());
    for(int i = 0; i < edges.size(); ++i)
        for(auto& x : edges[i])
            simple_edges[i].push_back(f(x));
    return simple_edges;
}
Back to top page