Now for each component find the maximum shortest distance and store it in result
vector < int > result ; int numOfComp = components . size ( ) ; int maxDistance ; for ( int i = 0 ; i < numOfComp ; i ++ ) { maxDistance = maxInThisComponent ( components [ i ] , graph ) ; result . push_back ( maxDistance ) ; } return result ; }