Topological Ordering of Graphs

Поділитися
Вставка
  • Опубліковано 7 вер 2024

КОМЕНТАРІ • 35

  • @abanerjee3704
    @abanerjee3704 2 роки тому +15

    It's amazing how you made it look like so simple. Accurate and precise explanation. Thanks a lot professor.

  • @ilkeakcay8860
    @ilkeakcay8860 3 роки тому +7

    This is by far the best video I watched on this topic, thank you!

  • @tejashiremath3458
    @tejashiremath3458 7 днів тому

    Really Well Explained!

  • @bradleyli1569
    @bradleyli1569 5 місяців тому

    The channel deserves more subscribers!!

  • @dogafincan
    @dogafincan 3 роки тому +1

    Great explanation. Thank you Professor!

  • @jamesfrake
    @jamesfrake 2 роки тому

    I think it's worth mentioning that the reason that all the examples you mentioned are directed and acyclic is that *time* is the common factor between them. I struggle to think of a practical application of DAGs that isn't specifically a DAG _because_ of time.

    • @maryelainecaliff
      @maryelainecaliff  2 роки тому

      That is a fair point. We're generally talking about dependencies, and dependencies would consistently be forcing on thing to be done before another, which is about time.

    • @temitopehardhekheyhe7359
      @temitopehardhekheyhe7359 2 роки тому

      @@maryelainecaliff How about order? as opposed to time??

    • @maryelainecaliff
      @maryelainecaliff  2 роки тому

      @@temitopehardhekheyhe7359 Do you have an example of an ordering that isn't time-based?

  • @ashtonronald
    @ashtonronald Рік тому +1

    thanks, professor!

  • @Xyz12391
    @Xyz12391 2 роки тому +1

    Great video, thanks!

  • @nanyaar
    @nanyaar Рік тому

    Thanks mam learning from India .

  • @Jiftyj
    @Jiftyj Рік тому

    really good! thanks

  • @sactecnos2708
    @sactecnos2708 10 місяців тому

    thank you so much, you saved me! :D

  • @juhijadhav2999
    @juhijadhav2999 Рік тому

    what if we have 3 vertices having 0 in degree in the initial step?

  • @exe.m1dn1ght
    @exe.m1dn1ght 4 місяці тому

    I don't understand, this is Depth First Search.. Why all the complication with In-Degree arrays ??

    • @maryelainecaliff
      @maryelainecaliff  4 місяці тому +1

      Actually, it's a breadth-first search, deliberately limited so that a node is not taken until all of the nodes it depends on are taken. The in-degree array is how we ensure that we don't take a node until all of its dependencies have been taken, which is the point of a topological ordering or topological sort.
      You could also do a topological ordering depth-first, but it's generally agreed that the breadth-first approach produces the more desirable result in general.

    • @exe.m1dn1ght
      @exe.m1dn1ght 4 місяці тому

      @@maryelainecaliff thanks, but i did some tests with DFS and a hashmap that store visited and it's yelding the same result so what s the difference?

    • @maryelainecaliff
      @maryelainecaliff  3 місяці тому

      @@exe.m1dn1ght I can't tell you without knowing more precisely what you did.

  • @aniruddhyadav430
    @aniruddhyadav430 Рік тому

    Namaste 🙏 Teacher

  • @temitopehardhekheyhe7359
    @temitopehardhekheyhe7359 2 роки тому

    I just can't help but think that this particular implementation might be kinda expensive?? O(N^2)??

    • @maryelainecaliff
      @maryelainecaliff  2 роки тому +4

      The time complexity or the algorithm is generally V+E, where V is the number of vertices and E is the number of edges. We don't typically think in terms of N when discussing the complexity of graph algorithms, because there are two different relevant sizes: the number of vertices (V) and the number of edges (E).
      Setting up the initial array of indegrees may be either V^2 or V+E, depending on your choice of graph representation (adjacency matrix or adjacency list).

    • @temitopehardhekheyhe7359
      @temitopehardhekheyhe7359 2 роки тому

      @@maryelainecaliff Oops sorry😄, my bad🤦‍♂, am addicted to performance and fast code and that pseudocode implementation just kinda flew right in my face, but yeah, understand what you mean 🙂... gracias for replying!😃

    • @maryelainecaliff
      @maryelainecaliff  2 роки тому +4

      @@temitopehardhekheyhe7359 It's always important to remember that performance is a relative thing. There are problems for which O(n^2) is ridiculously slow and others where it is the minimum performance required. Computational complexity must always be considered in context.

  • @surters
    @surters 3 роки тому

    Khan's algorithm if I'm not mistaken. en.wikipedia.org/wiki/Topological_sorting

  • @aaronl8443
    @aaronl8443 2 роки тому

    wow...