So, i´d like to know the lenght of every path using a dfs algorithm, but my graph input is an incidence matrix. I know an implementation of a dfs algorithm in python, but it uses an adjacency list to represent a graph (a dictionary, in fact). Also, i only need to know the lenght of every path, not the path itself.
Кто-нибудь знает, какую адаптацию мне нужно сделать?





Не могли бы вы показать код, который у вас есть, вместе с образцом ввода и ожидаемым результатом?