Computational Essay
Sample Content
▼
Open Guidelines
Tools
Check
Publish to Cloud
Submit to Notebook Archive
Insert Code Group
Insert Headings▼
Insert Text▼
Open/Close Groups▼

Graph theory, NP hard combinatorial optimization and world geography

AuthorName
Abstract

Section

I can find a graph of all countries in Eurasia
In[]:=
ℰ=NestGraphCountryData[#,"BorderingCountries"]&,
France
COUNTRY
,12;​​ℰ=UndirectedGraph[ℰ,ImageSize->Full,VertexLabels->(Normal@AssociationMap[Placed[Labeled[#["FlagImage"],#["Name"]],Tooltip]&,VertexList[ℰ]])]
Out[]=
Analyze the structure of the graph. What countries are farthest away and how far are they?
In[]:=
mostDistantCountries=GraphPeriphery[ℰ]
Out[]=

East Timor
,
Papua New Guinea
,
Lesotho

Make a manipulate for FindShortestPath.
In[]:=
DynamicModule{EurasianCountries,countryCenters,shortestPath},EurasianCountries=VertexList[];x(*countryCenters=CountryData[#,"CenterCoordinates"]&/@EurasianCountries;*)(*shortestPath=FindShortestPath[,startingCountry,destinationCountry];*),(*GeoGraphPlot[,GraphHighlight->shortestPath];*),startingCountry,
France
COUNTRY
,"Starting country",EurasianCountries,destinationCountry,
Nigeria
COUNTRY
,"Destination country",EurasianCountries,SaveDefinitions->True
ReplaceAll
:Null,startingCountry,
France
,Starting country,EurasianCountries,destinationCountry,
Nigeria
,Destination country,EurasianCountries,SaveDefinitionsTrue,14 is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
ReplaceAll
:DynamicModuleValues{},Null,startingCountry,
France
,Starting country,EurasianCountries,destinationCountry,
Nigeria
,Destination country,EurasianCountries,14 is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
Set
:Lists {Manipulate`Dump`include,Manipulate`Dump`exclude} and {IncludedContexts,ExcludedContexts}/.DynamicModuleValues{},Null,startingCountry,
France
,Starting country,EurasianCountries,destinationCountry,
Nigeria
,Destination country,EurasianCountries,14 are not the same shape.
Out[]=
x