# Ticket #8403: trac_8403-part2.patch

File trac_8403-part2.patch, 1.9 KB (added by rlm, 11 years ago)
• ## sage/graphs/generic_graph.py

```# HG changeset patch
# User Robert L. Miller <rlm@rlmiller.org>
# Date 1276905940 25200
# Node ID bdaf0cf036ef5169bf326ec25abdcae06884fea4
# Parent  88286e3cf010031343a6759520fccacd12d10352
#8403 - fix #optional tags

diff -r 88286e3cf010 -r bdaf0cf036ef sage/graphs/generic_graph.py```
 a Definition : Computing a minimum spanning tree in a graph can be done in `n \log(n)` time (and in linear time if all weights are equal). On the other hand, if one is given a large (possibly \log(n)` time (and in linear time if all weights are equal) where `n = V + E`. On the other hand, if one is given a large (possibly weighted) graph and a subset of its vertices, it is NP-Hard to find a tree of minimum weight connecting the given set of vertices, which is then called a Steiner Tree. of course, always a tree :: sage: g = graphs.RandomGNP(30,.5) sage: st = g.steiner_tree(g.vertices()[:5])              # optional - requires GLPK, CBC or CPLEX sage: st.is_tree()                                       # optional - requires GLPK, CBC or CPLEX sage: st = g.steiner_tree(g.vertices()[:5])              # optional - GLPK, CBC sage: st.is_tree()                                       # optional - GLPK, CBC True And all the 5 vertices are contained in this tree :: sage: all([v in st for v in g.vertices()[:5] ])          # optional - requires GLPK, CBC or CPLEX sage: all([v in st for v in g.vertices()[:5] ])          # optional - GLPK, CBC True An exception is raised when the problem is impossible, i.e.