Exercise :

Open the Mathematica notebook Map.nb (MetroStationMap).The variable called Metro is a list of 5 graphs with the metro networks in Seoul, New York, Paris, Mexico City and London. The vertices of the graphs are labeled with the names of the stations. The variable CityName is a list which contains the names of the cities.

(a). Write an interactive program using Manipulate[...] that has a control button with five values 1,2,3,4,5. When the user selects a given value, you display the name of the city and the corresponding metro map. Because your program uses some global variables  defined outside Manipulate (like Metro), you should also set SaveDefinitions->True.

(b). Expand the model from part (a) with a second control which gets populated with the vertices of the corresponding graph.  When the user selects a vertex from the list, you show the corresponding metro station highlighted in green (or with increased size) on the metro network. Make the control type a PopupMenu. When the model is first compiled, the default vertex selected should be 5, and the label of the control should be “Metro Node”.

(c). Make an interactive model from part (b) with nodes v an u as parameters, that highlights the shortest path from v to u, if there exists such a path in the graph, otherwise it only highlights the two vertices. Use the function FindShortestPath[...].
After you make sure that your model works, please add another control, {mycolor, ColorSlider} which lets the user select the color that you will use to highlight the path (in place of just green).

(d). Make an interactive model that highlights a vertex v of G2 together with its parents and children (i.e. if there is an edge v->u, then v is called a parent node and u a child node). The function NeighborhoodGraph[...] might be of help.

(e). New! (Combined Statistics): Make an interactive model from part a) that outputs certain statistics about the metro maps. Parameters: a control button with 5 values 1,2,3,4,5, and a checkbox parameter called statistics, with two values {True, False}. If “statistics” is selected, then the model outputs two pie charts: for the first pie chart you count the total number of metro nodes for each country, and display the 5 values in a pie chart. The second pie chart displays the number of metro hubs for each country. If “statistics” is not selected, then you output the same thing as in part a).

data={1,2,8,10, 8};
datanames={" Name1 ", " Name2 "," Name3 "," Name4 ", "Name 5"};
P=PieChart3D[data,PlotLabel->"Title of Pie Chart",ChartLabels->Placed[datanames,"RadialCallout"]]

(f). New! (Metro Hubs): A Metro hub is a metro station which has direct connections to five or more other metro stations. Make an interactive model where the metro hubs are highlighted with VertexSize->1.2
Use for example VertexInDegree[..] to count the number of incoming edges for each node. You may also need to use the function Sort[..] (check also the Mathematica documentation on Sort).

(g). Optional (Combined Interactive Model): Parameters: nodes v and u, and an extra parameter “option” with values {b,c,d}. If “option” b is selected, then the model outputs the same thing as part (b), If “option” c is selected, then the model outputs the same thing as part (c) etc. If you skipped some part, say (d), then you should allow only two values for “option”, {b,c}.