Hi all, I wasn't sure if I should submit a ticket on this or not, since it seems to fall under "unexpected behavior" rather than "software bug." I've been working through some small graph theory problems and was computing minimum spanning trees on graphs with weighted edges (where edges were assigned a weight as their label). I was getting completely unexpected behavior; after some digging, I found that G.min_spanning_tree() defaults to setting all edge weights to 1, even if the edges have weights assigned. [Note: I was working in 4.4.4; now updating to 4.6]
Perhaps it's just me, but I would expect that if an edge is created with a number label that Sage recognize it as a weight and act accordingly. This may be a difference of philosophy (better to have predefined, easy to understand, works-every-time default behavior than several exceptions and subcases) or of course be due to my ignorance of how Sage portrays graphs more than anything. On the other hand, I think the behavior expected by those with a level of ignorance similar to my own might be similar. Perhaps in G.min_spanning_tree() we could have the default weight_function be something like def weight(edge): try: return RR(edge[2]) except: return 1 Any thoughts? Best, Graham -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org