Mathematica, Matrices and Graph Theory

Click For Summary

Discussion Overview

The discussion revolves around issues encountered while using Mathematica to work with a 30 X 30 matrix, specifically in generating a minimum spanning tree (MST) from a weighted graph. Participants are exploring the retrieval of edge weights associated with the MST.

Discussion Character

  • Technical explanation, Homework-related, Debate/contested

Main Points Raised

  • One participant reports that the edge weights of the minimum spanning tree are incorrectly returned as 1 for every edge, despite the original graph providing correct weights.
  • Another participant expresses a similar problem and seeks assistance, indicating a potential common issue.
  • A third participant questions the terminology used, specifically the term "edgeweight," and suggests that the inquiry may be related to a homework assignment due to the nature of the request.
  • A later reply offers a workaround by using the Hadamard product of the unweighted matrix with the original weights to obtain the weighted adjacency matrix of the MST.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the nature of the problem or the terminology used. Multiple competing views remain regarding the interpretation of "edgeweight" and the appropriateness of the request.

Contextual Notes

There may be limitations related to the definitions of edge weights and the assumptions about the graph's structure that are not fully articulated in the discussion.

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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
Replies
1
Views
2K