ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Depth-first search on a directed graph

Автор: We all love coding interviews

Загружено: 2023-02-19

Просмотров: 8969

Описание: Depth-first search algorithm 👇

What is a depth-first search (DFS) algorithm?
The Depth-first search algorithm is a graph traversal algorithm. It might be used to find a path, but it cannot be used to find the shortest one. The algorithm is implemented in a recursive manner, where it:
a) explores all paths leading from one adjected node.
b) once visiting the last reachable node, it backtracks to the previous node.
c) explore the next adjected node.
It has a time complexity of (V+E) and memory complexity of O(V)*

DFS is the backbone of many algorithms, and augmented allows for finding strongly connected components, checking if the graph is connected, and defining articulation points and bridges.


What is the visit function?
The visit function represents the operation we want to perform on the graph's nodes.
It might be a function that, for example:
a) compares the node with a target
b) store nodes in some order
c) modify it (as in the video, where the color of the given vertex is changed)

Pros:
a) It's easy to implement.
b) It might be faster than a breadth-first search when there are multiple paths to the target node/s.

Cons:
a) It cannot be used to find the shortest path.
b) It might consume more memory than a breadth-first search. In the worst case, the stack call might store V frames* (Imagine a graph that looks like a linked list).


Best,
Albert 🤘

*Where V represents the number of vertexes, and E the number of edges in the graph.


#depthfirstsearch #dfs #algorithm #coding #programming #computerscience #python #python3

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Depth-first search on a directed graph

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

5.1 Graph Traversals - BFS & DFS -Breadth First Search and Depth First Search

5.1 Graph Traversals - BFS & DFS -Breadth First Search and Depth First Search

Depth First Search (DFS) Explained: Algorithm, Examples, and Code

Depth First Search (DFS) Explained: Algorithm, Examples, and Code

Японец по цене ВАЗа! Оживляем пацанскую мечту :)

Японец по цене ВАЗа! Оживляем пацанскую мечту :)

Breadth First Search (BFS): Visualized and Explained

Breadth First Search (BFS): Visualized and Explained

Я СДЕЛАЛ ИДЕАЛЬНЫЙ ШАР ИЗ ОБЫЧНОЙ ЗЕМЛИ - ДРЕВНЯЯ ЯПОНСКАЯ ТЕХНИКА

Я СДЕЛАЛ ИДЕАЛЬНЫЙ ШАР ИЗ ОБЫЧНОЙ ЗЕМЛИ - ДРЕВНЯЯ ЯПОНСКАЯ ТЕХНИКА

Depth First Search (DFS) on Directed graphs and Cyclic Graphs

Depth First Search (DFS) on Directed graphs and Cyclic Graphs

G-6. Depth-First Search (DFS) | C++ and Java | Traversal Technique in Graphs

G-6. Depth-First Search (DFS) | C++ and Java | Traversal Technique in Graphs

Graphs: Edge List, Adjacency Matrix, Adjacency List, DFS, BFS - DSA Course in Python Lecture 11

Graphs: Edge List, Adjacency Matrix, Adjacency List, DFS, BFS - DSA Course in Python Lecture 11

Algorithms: Graph Search, DFS and BFS

Algorithms: Graph Search, DFS and BFS

3 Types of Algorithms Every Programmer Needs to Know

3 Types of Algorithms Every Programmer Needs to Know

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]