Show in graph
A*

Software → Algorithms & Data Structures

Graph Data Structure

A data structure made of vertices and edges representing relationships between entities.

Motivation

A graph solves the problem of representing things connected by relationships rather than by a simple list or tree.

Where it fits

It belongs to algorithms and data structures and directly supports dependency graphs, networks, social graphs, routing, and this knowledge map.

Mental model

Nodes are things. Edges are relationships between things.

Important details

Graphs may be directed or undirected, weighted or unweighted, cyclic or acyclic. Traversal algorithms such as BFS and DFS are common tools.

Common mistakes

  • Using a tree when relationships are many-to-many.
  • Ignoring direction and edge meaning.