Function to Adjacency List Representation of a Graph
void makeGraph ( vector < pair < pair < int , int > , pair < int , char > > > & vp , int m ) { for ( int i = 0 ; i < m ; i ++ ) { int a = vp [ i ] . first . first - 1 ; int b = vp [ i ] . first . second - 1 ; int cost = vp [ i ] . second . first ; char color = vp [ i ] . second . second ; graph [ a ] [ b ] [ color == ' W ' ] = cost ; graph [ b ] [ a ] [ color == ' W ' ] = cost ; } }