Bug fix in encoding subgraph DFS algorithm