Below function uses above two method to get the maximum shortest distances in each component of the graph the function returns a vector , where each element denotes maximum shortest path distance for a component
vector < int > maximumShortesDistances ( vector < vector < int > > & graph , int N ) {