Kahn's Algorithm for Topological Sorting with Pseudo Code | Logic First

Опубликовано: 21 Август 2020
на канале: Logic First
4,069
78

What is topological sorting? Kahn's algorithm for finding topological sort and detecting presence of cycles in graph is explained with example. Complete concept building video for kahn's algorithm.

Kahn's algorithm steps,

-Calculate indegree of all vertices
-Initialize visited count to 0
-Where to start? Vertices with indegree 0
-Add all vertices with indegree 0 to a Q
-DeQ a vertex and
-Add it to Topo order list
-Decrement indegree of its adjacent vertices by 1
-If indegree of any vertex becomes 0, add it to Q
-Increment visited count
-Stop when Q is empty
-If visited count equals total nodes, then print topo order
-If not, it indicates presence of cycle



Topological sort video,
   • Topological Sort  

Mastering loops playlist,
   • Mastering loops  

Learn C programming playlist,
   • Learn C programming  

Website link,
https://logicfirstcoding.com/

My Programming channel in Tamil language,
   / @logicfirsttamil  


На этой странице сайта вы можете посмотреть видео онлайн Kahn's Algorithm for Topological Sorting with Pseudo Code | Logic First длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Logic First 21 Август 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 4,069 раз и оно понравилось 78 зрителям. Приятного просмотра!