Graphs: Planarity

    Graphs: Planarity

      The larger a graph gets, the more it looks like an amateur filming the zombie apocalypse. The more nodes and edges that come together to form a mash of shapes and lines, the less clear the graph becomes, making it indistinguishable from a terrified pedestrian running with a camcorder.

      Just like the mob of people trying to outrun the slowly approaching hoard of zombies, things get tangled. Really tangled.

      At some point, the zombies will stop chasing you (well, hopefully) and you'll have to sort out whose arm belongs to who. In graph theory, the pre-zombie apocalypse normal, orderly day at the park type graph is known as a planar graph.

      To give a more formal and less mixed-metaphor filled definition, planar graphs are graphs without any intersecting edges. They usually look like rings when untangled and can sometimes look like stars when tangled. Key word: sometimes.

      Because their edges can't be confused, it's much easier to figure out what goes where on a planar graph, which makes people love them much more than their non-planar twins. They also just plain look nicer, which is very important to…anyone. If there's a way twist a non-planar graph into shape, you're going to want to do it.

      We suppose you could also make a planar graph non-planar, but you'd probably accidentally start an actual apocalypse.

      Zombies are optional.

      Sometimes, though, a graph can't be made planar no matter how many deals with the zombies you try to strike. For example, imagine a two-dimensional post-zombie apocalypse world with a street. As crazy as it is to imagine a street, try to stretch your imagination so that the street also has three houses, all needing post-apocalyptic resources like Laugh Tracks, Vespene Gas, and Salsa (the sauce, not the dance). In order for these houses—filled with post-apocalyptic sentient animals—to receive their resources, they'll all need to be connected to each utility across the street.

      If we made a graph of that—and trust us, we will—it would look like this:

      Three houses with a road to the right, separating those houses from their Salsa, Vespine Gas, and Laugh Track supplies.

      There's just one problem: in a perfectly two dimensional world, you can't actually have those pipes overlapping like that. Instead of sending the houses their much-needed salsa and vespene gas, you'll get blocked pipes. The utilities need to figure out a way to make sure they don't overlap, so they ask you, the graph theory expert.

      If you were offered a billion dollars to design and position the houses and utilities so that the pipes (edges) between them never cross, don’t take it. Not even a little. It's impossible to make planar unless those houses could magically jump out of their second dimension.

      Even if you try to be clever (and waste a bunch of piping by looping around everything) there will always be at least one cross-over point between the utility pipes. Don't get us wrong; there are solutions, they're just only popular in the third dimension. The only possible solutions are in three dimensions because then you can then stack pipes above and below each other in the ground.

      How do you know if a graph can be planar or not? It's simple: you can't. The only thing you can do is practice turning graphs planar and hope that you'll be able to see the clearly un-planar graphs when they pop up.

      Just like the zombie apocalypse.