DEV Community

Latricia Nickelberry
Latricia Nickelberry

Posted on

Graph data structure

Today I will like to discuss graphs and a little bit about how they work. Graphs are similar to trees, what makes them different is that trees are not allowed to have cycles, so if a graph have a cycle, then it's not a tree. Also, the tree nodes is connected in some way to another node. However, for graphs it is possible to not fully be connected.

Social networks is a good example of where a graph is used most frequently. Graphs are good with keeping track of the connections amongst each user. Graphs are also able to display when the user does not have any connections with a specific user.

Graphs have their own jargon each node is called a vertex. The lines between nodes are called edges. This is the basics about graphs. Once I learned that graphs are used in social networks I saw how powerful they are and how much you can do with them.

I plan on continuing to learn about the various data structures and in what ways they are implemented in real applications. Seeing data structures in action is very fascinating.

Happy coding!

Top comments (0)