Table of Contents

Vocabulary

Graphs Vertices/Nodes Edges Adjacent Undirected Graphs Directed Graphs Weighted Graphs Dense Graphs Sparse Graphs Adjacency Matrix Adjacency List

What Are Graphs?

<aside> đź’ˇ Graphs are data structures that contain a finite set of vertices (aka nodes) that with edges establishing the connection between vetrices. Graphs can represent a network or connections/relationships.

</aside>

IMG_D34088A49C13-1.jpeg

Formal Defintion of Graphs

<aside> đź’ˇ A graph $G(V, E)$ contains vertices, $V$ and edges, $E$. Vertices are a set of nodes ($V = \{set \space of \space nodes \}$). Edges are a subset of the $V \times V$ for an undirected graph ($E \subseteq \{V\times V\}$}).

We say that two nodes sre adjacent to each other if there exists an edge between them.

</aside>

Types of Graphs

Undirected Graphs

<aside> đź’ˇ Undirected Graphs are graphs where edges have a two-way relationship. For instance, there can be an edge from node $A$ to node $B$ and an edge from node $B$ to node $A$.

</aside>

IMG_7765EBCCDEC2-1.jpeg

Directed Graphs

<aside> 💡 Directed Graphs are graphs where edges have a one-way relationship. So, there can be an edge from node $A$ to node $B$. However, unlike a undirected graph, there’s no edge from node $B$ to node $A$.

</aside>

IMG_963146897024-1.jpeg

Weighted Graphs

<aside> 💡 Weighted Graphs are graphs where edges contain a “weight”, a value associated with it.

</aside>

IMG_65F1868EEEC4-1.jpeg

How Graphs Are Described