reading-notes


Project maintained by Razan-am Hosted on GitHub Pages — Theme by mattgraham

Graphs

What is a graph?

A vertex is similar to linked list nodes. A pair (x,y) is referred to as an edge. This communicates that the x vertex connects to the y vertex.

Graph terminology

graph1

Types of graphs

  1. undirected graph: the edges are bi-directional by default

for example, with the pair (0,1), it means there exists an edge between vertex 0 and 1 without any specific direction. You can go from vertex 0 to 1, or vice versa.

undirection

  1. directed graph: the edges are unidirectional

for example, with the pair (0,1), it means there exists an edge from vertex 0 towards vertex 1, and the only way to traverse is to go from 0 to 1.

directional

Types of graph representations

matrix

list

Real-world uses of graphs


References:

@By Jerry Ejonavi/Data Structures 101: introducing graphs in JavaScript