d(r, v) and d(r, v) will be equal when u and v are
at same level, otherwise d (r, v) will be less than
d(r, v)
Data Structures and Algorithms MCQ - Graph Algorithm
Applying BFS Algorithms
Starting from Q
Queue Q
Making Q’s child’s status 1.
Queue
Q| M| N| P
Making M’s child 1 (which are not 1)
Q| M| N| P| R
Making N’s Child 1
Q| M| N| P| R| O
(other are already 1)
| Status | |||||
| Q | M | N | O | P | R |
| 2 | 1 | 1 | Â | 1 | Â |
| 2 | 2 | 1 | Â | 1 | 1 |
| 2 | 2 | 2 | 1 | 1 | 1 |
Maximum possible value of n for which we have
complete tree and our 't' node is the last leaf node
at height 4.
So, the maximum possible value of n
= 1 + 2 + 4 + 8 + 16
= 31
Suppose G = (v, E) and G1 = (v, E1) such that
E1 ≤ E and v1 ≤ v
Consider an example
Consider the w(e) = 1 of e ∉ E1
it means the cost
of v1
to v4
is only 1 other edges having cost 0. It is
noted that G1
is connected (As shown in example).
Consider the w(e) = 1 of e ∉ E1
it means the cost
of v1
to v4
is only 1 other edges having cost 0. It is
noted that G1
is connected (As shown in example).for i = 1 ton
for j = 1 ton
for K = 1 ton
A[j, K] = max (j, K], A[j, i) + a(i, K)]
Anxn Matrix and A[j, K] = 1 if (j, K) ∈ E
so there exist a path from J to K and must contain
A[j, K] edges

