Graphs
9 min · PHP examples
Represent nodes and edges with an adjacency list, then traverse to explore connections.
PHP · Graphs0/5 cleared
Enemy 1 of 5
A graph is a set of nodes (vertices) and edges between them. An adjacency list maps each node to its neighbors — perfect for sparse graphs and interview problems.
Once you have adjacency, BFS and DFS from a start node count reachable nodes, detect cycles, or find paths.
You
Syntax Skeleton
Loading editor...
Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: 4