Corrected dfs
Final version of matrix graph