graph.svg
Node
Edge
What is a graph
A graph is a fundamental data structure consisting of nodes (vertices) and edges (connections) that represent relationships between entities. Graphs can be directed (edges have direction) or undirected (bidirectional). Graphs are the foundation for algorithms like BFS, DFS, shortest path, and network flow analysis, and are crucial for modeling real-world networks.
Interactive Graph Builder
Nodes
6
Edges
7
Graph Representations
A → [ ] B → [ ] C → [ ] D → [ ] E → [ ] F → [ ]
A B C D E F A 0 1 1 0 0 0 B 1 0 0 1 1 0 C 1 0 0 1 0 0 D 0 1 1 0 0 1 E 0 1 0 0 0 0 F 0 0 0 1 0 0
Code Representations