visited [ ] array to make nodes visited src is starting node for DFS traversal prev_len is sum of cable length till current node max_len is pointer which stores the maximum length of cable value after DFS traversal
void DFS ( vector < pair < int , int > > graph [ ] , int src , int prev_len , int * max_len , vector < bool > & visited ) {