State Abbreviations Graph

In a recent chat that I participated in, we were discussing US two-letter state abbreviations that were one letter off of each other (e.g., NY and NJ).

After that discussion, I was curious about whether it would be possible to step from any state abbreviation to any other by changing one letter at a time, using only valid states along the way. My first step was to determine if there were any state abbreviations which didn’t share a first or last letter with any other states, so I wrote a simple Ruby script to test that.

Matching StatesSo every state had at least one other state it could go to. Texas (TX) had the fewest, with only Tennessee (TN); Massachusetts (MA) had the most, as quite a few state codes start with M or end with A.

Now I needed to find out if all the states would connect to each other, or if there would be several distinct “neighborhoods” of states. I decided to do this visually by creating a graph, using the output of my script to draw the connections:

State One Letter Changes
Graph with US state abbreviations as the vertices, green lines connecting state abbreviations with the same first letter, and blue lines connecting state abbreviations with the same second letter

Based on this graph, it is possible for any state abbreviation to change to any other state abbreviation!

I was also curious about the number of steps needed to go between any pair of state abbreviations, so I wrote a path distance algorithm based on Dijkstra’s algorithm (but with each path having equal weight) to find the shortest number of hops between any pair:

State to StateBased on the results, the highest number of hops is 6 – so every state abbreviation can be changed into any other state abbreviation in at most six steps!


The Eleven-Slice Pizza

Is there a way to slice a pizza into eleven equal-area slices using only four cuts?

During a late-night Slack chat a last week, the subject somehow wandered onto eleven-slice pizzas, and the above question came up. I immediately demonstrated that if we don’t worry about area, it’s easy to get eleven slices with four cuts:


So is it possible to precisely place these four cuts so that the pieces are equal in area?

Continue reading