You have been requested to implement a graph represented a mapwith cities and roads between those cities. Each city is describedwith the following attributes: name, size of population, party(republican/democrat).
1) Write a Java program that will construct such a graph (nodesare the cities)
2) Implement the following graph where each vertex represent acity. You will generate your own data (city name, population sizeetc.)
V = {C1,C2,C3, C4, C5}
E = {C1->C2, C1->C3, C2->C4, C3->C4, C4->C5,C3->C5, C2->C5}.
3) Use the Depth-First search algorithm to print the thepopulation size of each city.
4) Write a method to find the city with the smallestpopulation
5) Use the Breadh-First search algorithm to print the populationsize of each city.
6) List the routes between city X and city Y; city X and city Yare the arguments of the method.
7) Test your Java code and turn the source source and the screenshots showin the results.
Reference:
https://stackabuse.com/graphs-in-java-representing-graphs-in-code
Expert Answer
Answer to You have been requested to implement a graph represented a map with cities and roads between those cities. Each city is …