implementation of dfs using adjacency matrix