Mathematica, Matrices and Graph Theory

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 4K views
Moonshine
Messages
31
Reaction score
0
Hello

I imported a 30 X 30 matrix into Mathematica. I made a graph out of this and then found the minimum spanning tree. Next, I printed off a list of the edges. I included the edgeweight option to get the associated weights listed next to each edge. My goal was to ultimately sum these weights.

The problem is, it returns 1 for every edgeweight of the minimum spanning tree. When I print the edgeweights for the graph from which the minimum spanning tree was made, the correct edgeweights are returned.

Any ideas what I'm doing wrong?
 
Physics news on Phys.org
Hi,
really sorry for the bump, I'm having the same problem. Any help would be greatly appreciated.
 
Would you clarify what you mean by "edgeweight". Do you mean this in the usual sense... I.e. A weighted graph? Also this must clearly be a homework assignment, right? Because both of you have the same weird request?
 
How exactly is this a weird request? I just want the weights of a minimum spanning tree.

Anyway I've found a way around this: to get the weighted adjacency matrix of the MST, I just took the pointwise (Hadamard) product of the unweighted matrix with the original matrix of weights.