Article 63GYP Adjacency networks

Adjacency networks

by
John
from John D. Cook on (#63GYP)

Suppose you want to color a map with no two bordering regions having the same color. If this is a map on a plane, you can do this using only four colors, but maybe you'd like to use more.

You can reduce the problem to coloring the nodes in a graph. Each node corresponds to a region, and there is an edge between two nodes if and only if their corresponding regions share a border.

Here is a sort of topologists's or graph theorist's view of the continental United States.

us_connectivity.png

This was created using the following sample code from the Mathematica documentation.

 RelationGraph[MemberQ[#2["BorderingStates"], #1] &, EntityList[ EntityClass["AdministrativeDivision", "ContinentalUSStates"]]]

You can recognize Maine in the graph because it's the only state that only borders one other state. Alaska is also easy to locate. Exercise for the reader: mentally add Hawaii to the graph.

The analogous graph for Texas counties took much longer to draw: there are 49 continental US states but 254 Texas counties.

texas_counties.png

This was created with the following code.

 RelationGraph[MemberQ[#2["BorderingCounties"], #1] &, EntityList[EntityClass["AdministrativeDivision", "USCountiesTexas"]]]

You can find El Paso county in the top left; it only borders one county just as Maine only borders one state.

Related postsThe post Adjacency networks first appeared on John D. Cook.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments