Skip to content

Обход графа в глубину#18

Open
EStarikov wants to merge 1 commit intomainfrom
grapg
Open

Обход графа в глубину#18
EStarikov wants to merge 1 commit intomainfrom
grapg

Conversation

@EStarikov
Copy link
Owner

No description provided.

Comment on lines +33 to +38
while self._dfs_stack:
vertex = self._dfs_stack.pop()
if vertex not in self._dfs_visited:
self._dfs_visited.append(vertex)
self._dfs_stack.extend(set(self.edges[vertex]) - set(self._dfs_visited))
return vertex

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не нужно занаво реализовывать DFS, просто возьми при создании итератора результат от DFS и итерируйся по этому массиву.

@Sneper-Breeze
Copy link

Почини проверки.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants