Q. Please provide a java code for the below question according to the instructions.In this part, you will build a regional network. Your solution should be in RegNet.java. The required method is described below. The idea here is to build a maximal regional network by prioritizing certain things: minimize total distance (the assumption is that this will minimize overall cost) while also maximizing connectivity between airports and maximizing the number of flights that are offered, while also minimizing the number of flights with a lot of connections. This is explained with a couple examples below. public static Graph run (Graph G, int max) Input: Input: • G: a complete, simple, undirected graph with positive edge weights. Vertices are airports edges represent flight distances between airports. • max: a positive integer value representing the airline's budget for this region Output: A new graph connecting as many airports in G as possible while keeping the total distance within the budget. Furthermore, this graph should try to include as many flights as possible and try to minimize the number of flights with a lot of connections.At this point, you're very likely confused. Hopefully, these examples will help.public class RegNet {
//creates a regional network
//G: the original graph
//max: the budget
public static Graph run(Graph G, int max) {
//To be implemented
}
}