chuong2a

26 Reputation

2 Badges

15 years, 33 days

MaplePrimes Activity


These are questions asked by chuong2a

Please help me Prims Code. Where am I wrong? Thanks. with(GraphTheory): G := Graph( { [{1, 2}, 3], [{1, 3}, 24], [{1, 4}, 35], [{1, 5}, 16], [{2, 3}, 5], [{2, 4}, 6], [{2, 5}, 17], [{3, 4}, 7], [{3, 5}, 38], [{4, 5}, 19] } ); DrawGraph(G); Prims := proc(G::Graph) local n, A, visited, i, j, k, min, a, b, T; k := 1; min := 999; T := Graph(0); A := WeightMatrix(G); n := NumberOfVertices(G); visited := { op( seq( 0, i = 1..n) ) }; visited[1] := 1; while k <>

Please help me DFS Code. Where am I wrong? Thank you.

 

Please help me BFS Code. Why am I wrong?

Page 1 of 1