Hi Albert, On Thu, Dec 22, 2011 at 5:30 AM, Albert <[email protected]> wrote: > Now my other > question: Why is this implemented like this?
For performance reason. > A minimum spanning tree > does not make sense in a not weighted Graph The default is to turn off sanity checks and use a weight function that returns unity for each edge. > and as far as I read the > documentation, "Is G weighted" is part of the sanity checks that is > performed in the kruskal Algorithm if check = True. Maybe I am not > seeing something elementary here, but I think that it should by > default take the weight-function into account. The functions min_spanning_tree() and kruskal() do take the weight function into account. Assuming that you don't want to toggle on sanity checks and you don't want unity weight for each edge, then supply your own weight function to the keyword weight_function in min_spanning_tree(), or to the keyword wfunction in kruskal(). See the documentation of min_spanning_tree() [1] for an example of passing in your own weight function. [1] http://www.sagemath.org/doc/reference/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.min_spanning_tree -- Regards, Minh Van Nguyen -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
