I want to implement the adjacency list graph representation from the book competitive programming 1.The implementation uses a vector of V vertices and for each vertex v,another vector that contains pairs of (neighboring vertex and it’s edge weight) that have connection to v.I am having problems to take input of this graph and showing the output.
In the book,they have done such declarations :
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
vector <vii> AdjList;
How should I take input of the following graph as adjacency list and output it's adjacency list representation ? Suppose , every cost of edge is 10.