According to the latest polls, the 2012 presidential race is going to be a close one, which means that–once again–it will come down to the swing states: As the electoral votes in Ohio, Florida, and seven other “undecided” states go, so goes the White House.

But the details are messy. With nine swing states in the mix, there are a total of 2^9 possible outcomes in tomorrow’s election. That’s 512 different possibilities.

Which, normally, would be too many to keep track of. But in today’s infographic, visualization all-stars Mike Bostock and Shan Carter boiled the “combinatorial explosion” of possible results down to a simple, interactive flowchart.

In a blog post, the designers explained their secret to keeping the chart simple:

We settled on a binary tree early on, but it wasn’t until Shan had the idea of collapsing parts of the tree into “decision” nodes that the design clicked. By pruning subtrees below the 270-vote threshold, you reduce the complexity substantially. More importantly, you get a much faster sense of what matters: who wins!

In other words, by halting each outcome branch once a winner is determined (once one of the candidates acquires over 270 electoral votes, or they tie), Bostock and Carter represented all of the meaningful outcomes while showing us only about a quarter of the total possibilities (the flowchart displays 140 nodes, or 27% of the total possible outcomes).

The designers used D3, a JavaScript library developed by Bostock, to create their graphic. Read more about D3 here.