Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica, Matrices and Graph Theory

  1. Nov 16, 2009 #1

    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?
  2. jcsd
  3. Mar 31, 2011 #2
    really sorry for the bump, I'm having the same problem. Any help would be greatly appreciated.
  4. Mar 31, 2011 #3
    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?
  5. Apr 1, 2011 #4
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook