September 06, 2019

Graphs Are Everywhere


A few years ago, I was interviewing for a new job and it was the first time I was asked to whiteboard algorithms. It did not go well. In fact, I got my ass handed to me.

I was not prepared. With no formal education in computer science, and just a couple years of writing mostly HTML templating and CSS, I didn’t have the skills to pass those tests. Motivated by that failure, I began learning some some basic computer science knowledge in the forms of data structures and algorithms. That education lead to my Intro to Data Structures and Algorithms course on Gaining this knowledge, it changed the way I see things in the world.

One of the data structures I find most interesting is the graph. A graph is a collection of nodes (also known as vertices) and edges (also known as links or lines) that connect those nodes. One specific type of graph is the directed graph. The edges of a directed graph convey direction; that is, it is not enough to show nodes are connected, but (and not to personify nodes too much) from who to whom. Each connection has a source and a target.

When I gained an understanding of directed graphs, I began to realize that graphs are everywhere. The world is full of them. I experience real life graphs the most when observing the relationships of people. I want to share some of those observations with you. Consider this an incomplete, haphazard online art exhibition of directed graphs in the real world.

The first graph in this gallery I title Mutuality. It is the graph that forms when two nodes are connected to each other in a reciprocating fashion. A cycle formed back and forth between the two. I want to point out that the graph implies no connotation of positive or negative relationship. A mutual relationship can be one of respect, love, or attraction, but it can easily be one of resentment, disdain, and hatred as well.

The next graph in this gallery I title Admiration. I find that I typically admire others for something I find lacking in myself. For example, I admire people with the courage to start their own businesses, as I find that I’m more risk-averse than I would like to be. But the ones I admire also admire others for traits they are lacking in, and so on and so forth. A cycle of admiration forms where everyone is looking at someone else for something they don’t currently have.

Admiration is an admittedly positive take on this graph. It could just as easily devolve into Envy.

It should also be noted that there can exist mutual admiration, and there can be cycles much greater than three people, but I hope the concept has been conveyed effectively.

The third piece in the gallery is something I’ve always struggled with, Loneliness. Without going into too many details here, I was always on the outside growing up. Even as a pretty successful adult, who’s on the in for many circles, I still often feel lonely. I’ve come to learn more about myself over the years, to understand the reasons why I feel this way, but knowing why doesn’t eliminate experiencing the feeling. If you’ve ever felt lonely, you’ve experienced this graph first hand.

The fourth installment in the graph gallery I have titled Interest. This one is also something I’ve experienced personally and continue to do as I gain new friends and grow my network. I imagine others have experienced it as well.

My specific depiction of “interest” is one of imbalance. There is a central node whose interest is directed at several other nodes, but all the other nodes are directed at them. There is no reciprocity.

As I mentioned, I’ve experienced this imbalance personally. What strikes me most about this graph is the wasted energy. Energy flows in one direction, no one ends up replenished or satiated.

To really get a picture of this, try dragging the nodes around the screen to organize them. Try making all the arrows point in roughly the same direction.

This one just sprang to me this morning as I was finishing this post, but I call it The Modern Coffee Shop. A few years ago, my wife and I binged through the show Friends, and what struck me as anachronistic was that the characters would hit on strangers in the coffee shop every few episodes. Cell phones had not proliferated, WiFi didn’t exist, smart phones weren’t even a figment of the imagination yet. People had fewer “personal technological barriers” that they could put between themselves and others.

I’m not saying this is a good thing or a bad thing. I’m not trying to place a judgment on it. I think we’ve made a trade off. There are fewer chances for spontaneous interactions and meeting new people, but for some people there is an increased sense of safety from the ability to put up these “barriers”.

I know I could be romanticizing something that didn’t really exist, but as an extrovert who loves talking to new people, the modern coffee shop where no one interacts, save for a few people, bums me out.


I could come up with many, many more directed graphs I find in the world, but I’m going to stop there. My only desire with this post was to share an interesting way of looking at the world through the lens of computer science.

You can find the component I used for this post on my blog’s Github page at and play around with it. Put it in a sandbox and have some fun.

Also, 1000 internet points to the people who figure out how I managed to get these svg graphs to stay centered despite the width of the screen and tweets at me. It’s hacky AF.

Liked the post?
Give the author a dopamine boost with a few "beard strokes". Click the beard up to 50 times to show your appreciation.
Need help with your software problems?

My team and I are ready to help you. Hire Agathist to build your next great project or to improve one of your existing ones.

Get in touch
Kyle Shevlin's face, which is mostly a beard with eyes

Kyle Shevlin is the founder & lead software engineer of Agathist, a software development firm with a mission to build good software with good people.

Good software by good people.
Visit to learn more
Sign up for my newsletter
Let's chat some more about TypeScript, React, and frontend web development. Unsubscribe at any time.
Logo for Array.reduce()
Check out my courses!
If you enjoy my posts, you might enjoy my courses, too. Click the button to view the course or go to Courses for more information.