975 views
3 votes
3 votes

What is the method to find no of topological ordering of a Directed Acyclic Graph?

For an instance, i found two graphs on internet, whose no of topological ordering is given but how to quickly calculate the total no of ordering?

Graph 1 Graph 1

For graph 1, no of topological ordering is 13. 

For graph 2, no of topological ordering is 48.

If I try to solve it by brute force method, then it's taking lot's of time. Is there any faster way?

1 Answer

0 votes
0 votes
for first graph

case 1:  now first calculate ending with 0

is same as ending with 10 (because 1 will come after 4,5,2,3  so its position should be just before 0)

now 4,5,2,3 can be arrange in 4!/3!=4    .........................here 3! because we have to maintain the sequence of 5,2,3

case 2: now calculate ending with 1

starting with 54 is 3!/2!=3

starting with 45 is 3!/2!=3

starting with 52 is 3!/2!=3

so total is 3+3+3=9

grand total 4+9=13

Related questions

20 votes
20 votes
1 answer
1
Lakshman Bhaiya asked Oct 16, 2018
5,126 views
Find the number of Topological order(sort) in the given graph?$(1)$$(2)$
2 votes
2 votes
0 answers
2
2 votes
2 votes
0 answers
3
h4kr asked Jan 10, 2023
348 views
0 votes
0 votes
1 answer
4
Rishav Kumar Singh asked Aug 26, 2018
1,331 views
If we apply Topological and DFS traversal.Is there any intersection of ordering? Please explain.