Skip to content

Instantly share code, notes, and snippets.

View a4addel's full-sized avatar

Ahmad Addel a4addel

  • Cairo, Egypt
  • 12:46 (UTC +03:00)
View GitHub Profile
# Introduction to Graph
A **graph** \( G \) is a mathematical structure consisting of a set of vertices (also called nodes) \( V \) and a set of edges \( E \), where each edge is a pair of vertices. Formally, a graph can be denoted as \( G = (V, E) \).
## Directed/Undirected Graphs
A **directed graph** (or digraph) \( G \) is a graph in which the edges have a direction associated with them. Each edge \( (u, v) \) in a directed graph goes from vertex \( u \) to vertex \( v \). In contrast
**undirected graph** is a graph in which the edges have no direction associated with them; they simply indicate a connection between two vertices.