# Wait-for graph

One such deadlock detection algorithm makes use of a wait-for graph to track which other processes a process is currently blocking on. In a wait-for graph, processes are represented as nodes, and an edge from process $P_i$ to $P_j$ implies $P_j$ is holding a resource that $P_i$ needs and thus $P_i$ is waiting for $P_j$ to release its lock on that resource. A deadlock exists if the graph contains any cycles. The wait for graph scheme is applicable to a resource allocation system with multiple instances of each resource type.