| Hosted by CoCalc | Download
edges=[(1, 2, 4), (2, 8, 4), (3, 8, 4), (4, 7, 5), (6, 8, 5), (1, 3, 6), (1, 7, 6), (4, 5, 6), (5, 10, 9), (2, 10, 7), (4, 6, 7), (2, 4, 8), (1,8, 9), (1, 9, 9), (5, 6, 9), (1, 10, 10), (2, 9, 10), (4, 9, 10), (5, 9, 10), (6, 9, 10)] G=Graph(edges) G.weighted(True) G.graphplot(edge_labels=True,save_pos=True).show()
import sage.graphs.spanning_tree
graphs.spanning_tree.
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python3.11/site-packages/smc_sagews/sage_server.py", line 1245, in execute compile(block + '\n', File "<string>", line 1 graphs.spanning_tree. ^ SyntaxError: invalid syntax
from sage.graphs.spanning_tree import kruskal E = kruskal(G, check=True);E
[(1, 2, 4), (1, 7, 6), (1, 9, 9), (2, 8, 4), (2, 10, 7), (3, 8, 4), (4, 5, 6), (4, 7, 5), (6, 8, 5)]
T=Graph(E) T.set_pos(G.get_pos()) T.graphplot(edge_labels=True).show()