@taxatogaming I might have to write that solution! If you do write it, I'd love to see your code. As it turns out, though, day 5 was a total ordering, so I ended up solving it with quicksort.
If I have a list of valid output nodes, how do I identify dead ends (paths that don't lead to a single valid output node) and skip them in the algorithm?
I guess it was as I expected, the recursive implementation seems trivial enough, I wonder how you would implement topological sort via iteration, the "go backwards" with dfs using iteration seems challenging
I was wondering this too… I think it just worked better with his demonstration. E being searched first would still result in a valid topological sort since B is it’s only prerequisite
It's arbitrary, you can flip the E and F. Them being letters is just a way to label them to communicate here. They could just as well have been farm animals or colors
i think there was a mistake: the first one which you return from to parent should be added to the stack, accordingly 'E' was the first one to come back after exploring to 'B' . i don't know if i am right or not but yes your ans would be right if you had not visited 'E' first. if you had visited 'F' first from 'B' then the order would have been the same as yours.
Best explanation/visualization by far! Thank you my G!
Excellent visualization, seen many videos and this is by far the clearest. Well done
Best explanation of Topological sort, its just DFS in reverse completion of node. That so fundamental and simple to understand
"we have explored all the children" ok then ...
bro?
hahah yeah algorithms or IT are often pretty weird when it comes to parent-children relationship
Topological sort with the Diddy algorithm
Nice explanation , concise and clear , suitable for learning concept ,one day before exam.
Awesome! This is spot on fundamental.
Thanks
thanks carl the person😄
You are a politecnico di torino student?
@@ENTJ616 nope
thank you for this visual and explaination!
I am here to learn topological sort after advent of code day 5. 📝
Haha same
@taxatogaming I might have to write that solution! If you do write it, I'd love to see your code. As it turns out, though, day 5 was a total ordering, so I ended up solving it with quicksort.
thank you! this really helped.
Nice explanation.
Thanks so much 🙏🙏🙏
Is there any way to start on a node that has dependencies, or do you always need to start on a node with no dependncies?
If I have a list of valid output nodes, how do I identify dead ends (paths that don't lead to a single valid output node) and skip them in the algorithm?
i just wonder that in the ABC, E come first so why would you choose to go with F.
Since topological sort usually tends to have multiple solutions im guessing he just want to go to F first
dfs doesn't need to occur in any order, you're fully exploring the graph anyways, there are many valid solutions, so, it just doesn't matter
You can also do it that way. Please learn DFS before this algorithm
you always have to go in an alpabetical order genraly
Well explained
thanks!
good shit
I guess it was as I expected, the recursive implementation seems trivial enough, I wonder how you would implement topological sort via iteration, the "go backwards" with dfs using iteration seems challenging
backtracking
Backtracking is also often implemented recursively, though it doesn't have to be
So you literally just do depth-first traversal of the whole thing and store the nodes in that order?
yes
Why did your DFS explore F before E? Am I wrong in assuming it's going in alphabetical order?
I was wondering this too… I think it just worked better with his demonstration. E being searched first would still result in a valid topological sort since B is it’s only prerequisite
It's arbitrary, you can flip the E and F. Them being letters is just a way to label them to communicate here. They could just as well have been farm animals or colors
yes! agreed@@OatmealTheCrazy
Yes E must be visited first . Point is dfs is always unique but topsort is not unique , we can have many topological sort sequences
Is dfs for a directed graph unique? (Considering ascii values) I’m not sure
Thanks ❤
great vid :)
but how are you going to K even if G points to it and he have not visited it yet?
Yeah, but how we go from array to graph, we need additional functions.
thanks💯
thanks broooo
nice
Hope you always have toilet paper in the public restroom!!!
i think there was a mistake:
the first one which you return from to parent should be added to the stack, accordingly 'E' was the first one to come back after exploring to 'B' . i don't know if i am right or not but yes your ans would be right if you had not visited 'E' first. if you had visited 'F' first from 'B' then the order would have been the same as yours.
I love u
Gay
@@typingcathaha
@@typingcat XDDDDDD