Page 1
Project assignment
Determing the most efficient way
to connect the network
Tom von Hegedus, Jochem Lentz, George Karlos,
Zakaria Nafid, Mike Spadaru,
Group 4c
Page 2
Understand the problem
We have 2 problems:
• Total weight of the initial graph
• Total weight of the Minmumspanningtree
• initial weight – minimumspannigtree
weight = the solution
Page 3
What do we have?
• A text document with a lot of numbers
• We know that the weighted graph has 40
vertices.
• So we need a 40x40 matrix
Page 4
Import
Import["C:\\Users\\Tom\\Documents\\network.txt"]
Page 5
WeightedAdjacencyGraph
• Replace all the – with ∞
• Make 40 lines with 40 numbers
Page 6
WeightedAdjacencyGraph
Page 7
WeightedAdjacencyGraph
Page 8
WeightedAdjacency Matrix
• WeightedAdjacencyMatrix[m] // MatrixForm
• VertexList[m];
TableForm
[Normal@WeightedAdjacencyMatrix[m],
TableHeadings®{c=Style[#,Blue]&/@%,c}]
Page 10
Initial Graph Weight
• The weight of the initial graph is 261,832
Page 11
MinimumSpanningTree• Problems with Mathematica
• We used Prims algorithm on table by hand
Wrong !!!
Page 13
Minimum Spanning Tree
Page 14
Weight
• The Weight of the Minimumspanningtree
is 2153
Page 15
Solution
• Initial Graph Weight –
MinimumSpanningTree Weight = solution
• 261,832 – 2153= 259,679
Page 16
Problems
• The only problem was to get a
MinimumSpanningTree in Mathematica
Page 17
Solution strategies/ Algorithms/
tools
• Divide the problem into sub problems
• Prim’s Algorithm
• We used the site of Mathematica a lot
Page 18
Time spent on problem
• About 20 to 25 hours per person.
Page 19
Conclusion
• Not very hard project
• Problems with MinimumSpanningTree[]
function in Mathematica