Graph:
Vertex + edge (neighbors).
Representation:
Vertex 1) state 2) entity
Representation:
1) adj matrix
space : O(v ^ 2)
pros : look up for pair O(1). cons : sparse E << V
2) adj list
class Vertex {
int id;
List<Vertex> neighbors;
}
class Graph {
List<Vertex> vertices;
}
Sparse Table: