An Introduction To Graphs

Joshycsm
2 min readSep 14, 2020
https://www.youtube.com/watch?v=gXgEDyodOJU

There are many types of graphs. However, certain characteristics allow us to describe graphs.

There are directed and undirected graphs. These types of graphs are useful for describing traffic flow (i.e. of some kind of a system in which movement is not bi-directional).

A good way to think about an undirected graph is to think of it as a highway between two cities where you can go back and forth. On the other hand, directed will be a one way street where you can only go one way.

Another way to think about it is Facebook. What kind of graph do you think Facebook has? Well, it has an undirected graph because when I’m connected to a friend, that friend is also connected to me. It’s not one way.

What about Twitter? Twitter is more directed because if I have my profile, people can follow me and I can follow people. But if someone follows me I don’t necessarily follow them.

So Twitter is more directed. Another way to describe graphs is the idea of weighted graphs. Also, unweighted graphs. You might be going on a trip and trying to find the most efficient way to visit sites that interest you. In that case, Google Maps would use a weighted graph to decide what is the shortest path for you to get there. And these sort of graphs are used a lot in calculating optimal paths.

Another way to describe a graph is cyclic or acyclic. When you have vertices connected in a circular fashion, it’s called a cycle. So you can go from one node to another and back to the original node. With acyclic, you can’t do that. Cyclic graphs are common in weighted graphs such as Google Maps, because most of the time, there is a way to get back.

Now that we have gained some exposure to understand a way to describe graphs, consider doing some additional research on this topic.

As always, I highly recommend the Zero to Mastery Academy to improve your own personal skills as a programmer as this is where all this information was drawn from and Andrei Neagoie, the founder and lead instructor, has been a true mentor to me.

Photo credit: https://www.youtube.com/watch?v=gXgEDyodOJU

--

--