Isuranga Perera
Isuranga Perera

Reputation: 510

Which algorithm can I use to number the graph as follows

enter image description here

Each node in the above graph has been numbered.

I am trying to find the graph traversal algorithm that can be used to number the graph in this order. Appreciate if anyone can suggest an algorithm that can number them in the above order

Upvotes: -1

Views: 49

Answers (1)

Matt Timmermans
Matt Timmermans

Reputation: 59134

The order you give is consistent with a topological sort using Kahn's algorithm.

To get exactly the order you specify, when the algorithm chooses between multiple nodes that are available simultaneously, you have to choose the one with the highest BB label.

Upvotes: 0

Related Questions