Directed Graph Simulator

A directed graph stores edges with orientation: an edge from A to B does not automatically create an edge from B to A. This simulator focuses on directed traversal, indegree/outdegree, adjacency representations, and topological sorting of directed acyclic graphs.

BFS / DFSO(V + E)
Topological sortO(V + E)
Edge typeDirected
Topo requirementDAG

Graph editing and traversal

350 ms

Directed acyclic graph example loaded.

Vertices0
Edges0
Sources0
Sinks0

Traversal / topological order

Frontier

Current step

Adjacency list

Adjacency matrix

Directed graph concepts

Indegree and outdegree

Indegree counts incoming edges; outdegree counts outgoing edges. A source has indegree 0, while a sink has outdegree 0.

Direction matters

A → B and B → A are different edges. Reachability therefore depends on edge orientation.

Topological sort

Kahn's algorithm repeatedly removes vertices with indegree 0. A complete ordering exists only for a directed acyclic graph.

Cycle detection

If Kahn's algorithm cannot process every vertex, at least one directed cycle prevents a topological ordering.