ArticulationResult<GraphT>
find_articulation_vertices(GraphT& g) {
    g.initializeSearch();

    ArticulationResult<GraphT> result(g);
    auto pEarly = bind(&ArticulationResult<GraphT>::processEarly, ref(result), _1);
    auto pLate = bind(&ArticulationResult<GraphT>::processLate, ref(result), _1);
    auto pEdge = bind(&ArticulationResult<GraphT>::processEdge, ref(result), _1, _2);

    g.dfs("v1", pEarly, pLate, pEdge);

    return result;
}
void
dijkstra(GraphT& g, typename GraphT::Vertex& start) {
    using Vertex = typename GraphT::Vertex;

    g.initializeSearch();

    unordered_map<Vertex*, bool> intree;
    int weight;
    int dist;

    Vertex* v = &start;
    v->distance = 0;

    while (!intree[v]) {
        intree[v] = true;

        for (auto& e : v->edges) {
            auto w = e.w;
            weight = e.weight;

            if (w->distance > weight + v->distance) {
                w->distance = weight + v->distance;
                w->parent = v;
            }
        }

        dist = MAX_INT;

        for (auto& x : g) {
            if (!intree[&x] && (dist > x.distance)) {
                dist = x.distance;
                v = &x;
            }
        }
    }
}