Tivadar Danka Profile picture
Dec 4, 2023 15 tweets 6 min read Read on X
Understanding graph theory will seriously enhance your engineering skills; you must absolutely be familiar with them.

Here's a graph theory quickstart, in collaboration with Alejandro Piad Morffis.

Read on: Image
What do the internet, your brain, the entire list of people you’ve ever met, and the city you live in have in common?

These are all radically different concepts, but they share a common trait.

They are all networks that establish relationships between objects. Image
As distinct as these things seem to be, they share common properties.

For example, the meaning of “distance” is different for

• physical networks,
• information netorks,
• orf social networks,

but in all cases, there is a sense in which some objects are “close” or “far”. Image
What if we could study this abstract notion of networks of interconnected elements, and understand the fundamental properties of all sorts of networks all at once?

This is the purpose of graph theory, and we’re here to open a window for you to dive into this universe.
Intuitively, a graph is just a (finite) collection of elements — vertices, or sometimes nodes — connected by edges.

Thus, a graph represents an abstract relation space, in which the edges define who’s related to whom, whatever the nature of that relation is. Image
There is nothing intrinsic to names or exact locations of the vertices in the drawing.

The layout of a graph is arbitrary, and thus, the same graph can be represented in an infinite number of ways. Image
In the study of networks, indirect connections are as important as direct ones.

Speaking in the language of graphs, indirect connections are formalized by walks. A walk is simply a finite sequence of connected nodes.

For example, (a, b, a, e, c, d) is a walk on the graph below. Image
If we never repeat an edge, then we have a trail. The previous walk is not a trail because we backtrack through ab.

In contrast, (a, e, c, d, e) is a valid trail in our example graph, because although e appears twice, we get to it via different edges each time. Image
If we never repeat a vertex, then we have a path. For instance, (c, d, e, a, b) is a path that happens to involve all vertices.

However, if the path loops over from the final vertex back into the first one, so the start and end are the same vertex, we call it a cycle. Image
So, vertices and edges are the building blocks of graphs, giving rise to walks, trails and paths.

With these notions, we can start to ask general questions about the structure of a graph. One question is connectivity, that is, which vertices are reachable from each other. Image
An interesting question regarding connectivity is how critical a vertex or edge is regarding connectivity.

If removing a single vertex (or edge) from a graph splits a connected component into two or more, then that vertex is called a cut vertex (or cut edge). Image
In the previous graph, the removal of vertex a (and its corresponding edges) produces five connected components, while the removal of vertex b produces three. Image
The removal of the edge ab only produces two connected components. Image
Next time, we’ll be looking at trees, arguably the most important data structure in computer science.

This thread is a collaboration with @alepiad, and is only 15% of the full post.

You can find it in the alt text of this image; it's worth a read. https://thepalindrome.org/p/graph-theory-ep-00
If you have enjoyed this thread, share it with your friends and follow me for more no-nonsense top-tier technical content!

(Or say something nice in the replies; otherwise, The Algorithm is going to banish this post into oblivion.)

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Tivadar Danka

Tivadar Danka Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @TivadarDanka

Dec 11
The single most undervalued fact of linear algebra: matrices are graphs, and graphs are matrices.

Encoding matrices as graphs is a cheat code, making complex behavior simple to study.

Let me show you how! Image
If you looked at the example above, you probably figured out the rule.

Each row is a node, and each element represents a directed and weighted edge. Edges of zero elements are omitted.

The element in the 𝑖-th row and 𝑗-th column corresponds to an edge going from 𝑖 to 𝑗.
To unwrap the definition a bit, let's check the first row, which corresponds to the edges outgoing from the first node. Image
Read 18 tweets
Dec 9
Matrix multiplication is not easy to understand.

Even looking at the definition used to make me sweat, let alone trying to comprehend the pattern. Yet, there is a stunningly simple explanation behind it.

Let's pull back the curtain! Image
First, the raw definition.

This is how the product of A and B is given. Not the easiest (or most pleasant) to look at.

We are going to unwrap this. Image
Here is a quick visualization before the technical details.

The element in the i-th row and j-th column of AB is the dot product of A's i-th row and B's j-th column. Image
Read 17 tweets
Nov 23
The single biggest argument about statistics: is probability frequentist or Bayesian?

It's neither, and I'll explain why.

Buckle up. Deep-dive explanation incoming. Image
First, let's look at what is probability.

Probability quantitatively measures the likelihood of events, like rolling six with a dice. It's a number between zero and one. This is independent of interpretation; it’s a rule set in stone. Image
In the language of probability theory, the events are formalized by sets within an event space.

The event space is also a set, usually denoted by Ω.) Image
Read 33 tweets
Nov 19
The single most undervalued fact of linear algebra: matrices are graphs, and graphs are matrices.

Encoding matrices as graphs is a cheat code, making complex behavior simple to study.

Let me show you how! Image
If you looked at the example above, you probably figured out the rule.

Each row is a node, and each element represents a directed and weighted edge. Edges of zero elements are omitted.

The element in the 𝑖-th row and 𝑗-th column corresponds to an edge going from 𝑖 to 𝑗.
To unwrap the definition a bit, let's check the first row, which corresponds to the edges outgoing from the first node. Image
Read 18 tweets
Oct 25
The following multiplication method makes everybody wish they had been taught math like this in school.

It's not just a cute visual tool: it illuminates how and why long multiplication works.

Here is the full story: Image
First, the method.

The first operand (21 in our case) is represented by two groups of lines: two lines in the first (1st digit), and one in the second (2nd digit).

One group for each digit.
Similarly, the second operand (32) is encoded with two groups of lines, one for each digit.

These lines are perpendicular to the previous ones.
Read 10 tweets
Oct 21
The way you think about the exponential function is wrong.

Don't think so? I'll convince you. Did you realize that multiplying e by itself π times doesn't make sense?

Here is what's really behind the most important function of all time: Image
First things first: terminologies.

The expression aᵇ is read "a raised to the power of b."

(Or a to the b in short.) Image
The number a is called the base, and b is called the exponent.

Let's start with the basics: positive integer exponents. By definition, aⁿ is the repeated multiplication of a by itself n times.

Sounds simple enough. Image
Read 18 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(