Everything is a graph

You know graphs, right? Those data structures that consist of nodes and links. A perfect structure for capturing relationships and modeling the parts of our real world. There is even a company that has gone as far as using graphs to basically help governments spy on everyone and extract valuable data from Ukrainian battlefield.

Palantir rockets past $1B, yet its rise carries a chilling warning of mass surveillance

Palantir’s $440B surge: How Alex Karp and Peter Thiel’s AI empire fuels fears of government surveillance

Palantir, the Secretive Tech Giant Shaping Ukraine’s War Effort

In Ukraine, Palantir’s AI-driven data analytics are helping the military with real-time intelligence and supporting demining and reconstruction efforts.

But how do you begin thinking in graphs?

Let's take a cup of tea I'm drinking at the moment as an example:

This is almost valid YAML! We have a data point. Now, let's break it up into a graph. Remember - links can also contain valuable data, not just nodes; and quality of a graph is determined by quality of its links.

Boom, we expressed it as a graph, which in fact looks more like a tree, but it's enough to illustrate the point. Here, every node *and link* contain a text value, let's assume it's called `name`. In code, they can be pointers to any data type, whether it's a movie, a social media account, an upvote, or your pet's location. We can find the location of all spoons in the world just by querying the world graph.

Graphs in practice

Through graphs, social media find you content, new friends, follows, and followers. An Instagram algorithm learns what you like by linking you to specific interests and feeding you more of the same in Reels and timeline. You browse accounts, and Instagram tells you that some who you follow also follow this and that person. And of course, the graph of your likes, reposts, and comments helps Meta serve you ads so precise that you think Meta listens to your conversations.

In social relationships, when you need a job, you likely ask your friends if they could help. Some refuse, some use help from their friends (thus, friends of your friends begin working towards your goal of finding a job) and your job request has gone one social graph layer deeper.

If you enjoy a good movie, you may have heard of Six Degrees of Kevin Bacon. It's a game where you need to find a path from a given actor/actress to Kevin Bacon. If you give me John David Washington as a starting point and replace Kevin Bacon with Leonardo DiCaprio as a goal, my path will look like this: John David Washington -> played The Protagonist in TENET -> filmed by Christopher Nolan -> he filmed Inception -> Leonardo DiCaprio played Dom Cobb in Inception. Try that yourself, and you'll find that you are doing search for the shortest path in a graph - something Dijkstra's algorithm also does.

Dijkstra&#039;s algorithm

Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a weighted graph, which may represent, for example, a road network. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later.

When you use Google Search to find a movie, Google recognizes that you found lots of movie-related results and begins filling its Knowledge Graph by extracting relevant information from IMDb, Rotten Tomatoes, Reddit, and streaming services. Searching for a game? Bam, here is the release date, platforms, genres, reviews, and storefronts, all sourced from Steam, Xbox, PlayStation, Nintendo, and oftentimes Metacritic.

Look, lots of clickable items, ripe for the exploration!

Look around

Take a moment. Look around you. Try playing with graphs in FigJam. Maybe try Obsidian - it also has a graph view. Speaking of which, here is mine for this article and linked concepts:

You can immediately notice that a node called "Graph" is a bit bigger. Obsidian makes nodes with higher amount of links bigger to highlight their importance. You can also see this article, highlighted in red, and maybe notice that I wrote something about trees if you look deeper.

See? Linking is thinking.