Legend Brown Ale + Graphs
How we got here and what we drank.
Today I find myself enjoying a Legend Brewing Company Brown Ale on the dock at my mother in law's home. She lives at Lake Anna, Virginia, right on the water. Even though I love the Pacific Northwest, it's always relaxing to come down to the lake and sip a beer by the water.
Since I do live in the Pacific Northwest and my mother in law in central Virginia, I had to travel here somehow. The distance is great enough that flying is the only viable option (though someday I hope to take the train — with the right tickets, I could get to Culpeper, Virginia, which is only a short drive away). Taking a flight always reminds me of the data structure we call a graph, so that's what we'll cover in today's Computer Science + Beer.
Confession: I didn't drink this one out of a glass. Burn the heretic, I hear you cry. Well, that's the way it is when you're on vacation at the lake. I presume this would be a pretty standard-looking brown ale: Brown beer, light colored head, fairly clear.
We can examine the label, though, and I'll admit that it's off-putting to me. We have a unicorn rearing up in front of a red heraldic field surrounded by barley and hops: Quite Arthurian. I'm sure it's meaningful to the brewer and designer so I don't want to disparage, but it doesn't exactly scream "excellent beer" from the shelf.
A graph simply looks like a collection of circles connected by lines. The circles, officially called nodes, could represent airports served by a particular airline. The lines between them, or edges, could represent direct flights between the cities. In this example, if there's a line from my city to yours, I can fly straight there. If not, I might have to fly to one or more intermediate cities before I can get to you.
In keeping with my confession above, take this with a grain of salt. I'm huffing through the mouth-scented rim of a bottle (you're welcome for that mental image). Despite adverse conditions, I get a lovely toffee note with little hop aroma. Nothing off (from the beer). There's a bit of a grainy note that's not unpleasant, and this is definitely going to be a sweet beer.
Any time you have a problem involving route-finding or networking, it should smell like a graph. Connections between entities, such as friends in a social network, are also a key place to think about graphs. There are specialized graphs that can solve other interesting problems: We'll cover trees and finite state machines another time.
Flavor and Mouthfeel
The toffee and grainy aromas I detected continued into the flavor. The brewer says molasses on their site, which I probably wouldn't have come up with on my own but it's not an unfair description. It's not as cloying as I feared, though definitely malty-sweet. It seems highly carbonated to me, which probably helps cut the sweetness. I also get a light hop bitterness (no particular flavor) on the tongue. Quite full-bodied — perhaps not the wisest beer choice on a 90 degree day, but I'm enjoying it nonetheless! Finishes sweet and sticky, a low point for me as I like my beers to finish fairly clean.
Graphs are pretty easy to draw on paper and relatively simple to implement in code. If I stripped out all the beer stuff, I could teach them to a bright five-year-old in 20 minutes. Graphs are well-studied, and we have stock solutions for a lot of different problems involving them. See, for instance, the dozens of ways to traverse a graph. Their simplicity and mathematical properties make graphs a powerful tool in the computer scientist's arsenal.
The beer's easily a 4.5/5 for me. I've passed this up in the grocery store numerous times on previous trips because I tend toward the aggressively-bittered styles, but it's a mistake I won't repeat. Despite the label, the beer is great and I'm excited to finish the six-pack. And that's not just the sun talking.
Graphs may be one of my favorite topics in all of computer science. I remember learning about them in a college class and thinking, "Nothing so simple could possibly matter — when are we going to get to the compilers?!" As it turns out, graphs are everywhere; they definitely matter. If you count trees as graphs, they're even a prerequisite for understanding compilers.
If you enjoyed this post, I'd love to hear from you. I'm open to topic ideas, writing improvements, fact checks, guest posts, conversations about beer or computer science, and pretty much anything else. Email me!