retagged by
29,272 views
63 votes
63 votes

Consider the following directed graph:

The number of different topological orderings of the vertices of the graph is _____________.

retagged by

5 Answers

Best answer
117 votes
117 votes
Here, start with $a$ and end with $f$.
$$a \;\_ \; \_ \; \_ \; \_ \; f$$
Blank spaces are to be filled with $b$, $c$, $d$, $e$ such that $b$ comes before $c$, and $d$ comes before $e$.
Number of ways to arrange $b$, $c$, $d$, $e$ such that $b$ comes before $c$ and $d$ comes before $e$, will be =  $4!/(2!*2!) = 6$
edited by
97 votes
97 votes

In topological sorting all nodes are like tasks and edges show the dependency among the tasks.

Node i to j an edge is there means task i must complete before task j.(in the mean time some other task may get complete after task i and before task j..but task i and j sequence need to be maintained)

Here in following 6 ways all the 6 tasks can get completed.

 

edited by
2 votes
2 votes
Bruteforce Method-

a bdce f

a bdec f

a dbce f

a dbec f

a bcde f

a debc f
edited by
Answer:

Related questions

36.1k
views
18 answers
85 votes
Sandeep Singh asked Feb 12, 2016
36,136 views
Let $G$ be a complete undirected graph on $4$ vertices, having $6$ edges with weights being $1, 2, 3, 4, 5,$ and $6$. The maximum possible weight that a minimum weight s...
13.4k
views
8 answers
50 votes
Akash Kanase asked Feb 12, 2016
13,434 views
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex $t$ at a distance four from the root. If $t$ is the $n^{\text{th}...
24.6k
views
9 answers
65 votes
Sandeep Singh asked Feb 12, 2016
24,600 views
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$. W=$\begin{bmatrix} 0&2 &8 &...
44.2k
views
21 answers
100 votes
Sandeep Singh asked Feb 12, 2016
44,221 views
For a host machine that uses the token bucket algorithm for congestion control, the token bucket has a capacity of $1$ $\text{megabyte}$ and the maximum output rate is $2...