Digraph-Theoretic Approach for Deadlock Detection and Recovery in Flexible Production Systems