chuong2a

26 Reputation

2 Badges

15 years, 62 days

MaplePrimes Activity


These are answers submitted by chuong2a

this is Depth First Search Algorithm - Given graph G = (X, E), X is the set of vertices, E is the set of edges. - Step 1: Sorting the vertices by order: x1, x2, x3... Choose arbitrary vertex x = x1, A = X – {x1} (remove x1 out of set of vertices). Initialize set of edges T = Ø. - Step 2: If N(x) (set of vertices near x) intersect with A = Ø, so going to Step 4. If N(x) intersect with A ≠ Ø, so going to Step 3. - Step 3: Choose min i so that xi in N(x) intersect with A, and choosing e = {x, xi}. T = T + e, A = A – xi, x = xi. Return Step 2. - Step 4: If x = x1 then stopping. T is the Tree. If x ≠ x1, then search predecessor x: x = pre(x). Return Step 2.
Page 1 of 1