Graphs

A graph is a non-linear data structure that can be looked at as a collection of vertices (or nodes) potentially connected by line segments named edges.
Here is some common terminology used when working with Graphs:
1- Vertex - A vertex, also called a “node”, is a data object that can have zero or more adjacent vertices. 2- Edge - An edge is a connection between two nodes. 3- Neighbor - The neighbors of a node are its adjacent nodes, i.e., are connected via an edge. 4- Degree - The degree of a vertex is the number of edges connected to that vertex.
Directed vs Undirected

undirected
An Undirected Graph is a graph where each edge is undirected or bi-directional. This means that the undirected graph does not move in any direction.

Directed Graphs (Digraph)
![]()
A Directed Graph also called a Digraph is a graph where every edge is directed.
Unlike an undirected graph, a Digraph has direction. Each node is directed at another node with a specific requirement of what node should be referenced next.
Complete vs Connected vs Disconnected

Complete Graphs
![]()
Connected Graphs

Disconnected Graphs

Graphs Acyclic vs Cyclic
