Message Boards Message Boards

How do you highlight graph communities in GeoGraphPlot?

I am wondering how to highlight different parts of a graph from FindGraphCommunities, and CommunityGraphPlot for a graph. This is simple with HighlightGraph but if there are geographical elements and the graph is visualized with GeoGraphPlot, HighlightGraph's functionality of automatically choosing different colors to highlight different induced subgraphs mapped over the graph communities is harder. Here is an example with KatzCentrality.

g = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}]
Part[VertexList[g], Ordering[KatzCentrality[g, 0.1], -2]]
Subgraph[g, #] & /@ FindGraphPartition[g, Length[%]], 
VertexSize -> Thread[% -> 1.5],  GraphHighlightStyle -> "DehighlightHide"]

I think there is a way to use GraphHighlight for GeoGraphPlot for this but I don't know how to automatically change the colors which this example automatically applies to the subgraphs. I also want to apply automatic coloring to graph communities. I don't know how to apply this code to correctly highlight graph communities with GeoGraphPlot.

\[ScriptCapitalE] = 
  UndirectedGraph@
   NestGraph[#["BorderingCountries"] &, Entity["Country", "France"], 
    12, VertexLabels -> 
     Normal[AssociationMap[
       Placed[Labeled[#1["FlagImage"], #1["Name"]], Tooltip] &, 
       VertexList[\[ScriptCapitalE]]]]];
HighlightGraph[\[ScriptCapitalE], 
 Map[Subgraph[\[ScriptCapitalE], #] &, 
  FindGraphCommunities[\[ScriptCapitalE]]]]
GeoGraphPlot[\[ScriptCapitalE], 
 GraphHighlight -> (Map[Subgraph[\[ScriptCapitalE], #] &, 
    FindGraphCommunities[\[ScriptCapitalE]]])]

I have created a Wolfram computational essay in the cloud and this issue is at the end at https://www.wolframcloud.com/obj/burbery1/Published/Graph%20Theory%20and%20countries.%20highlight%20graphnb.nb

POSTED BY: Peter Burbery
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract