Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004
d = {0: {1:-1/2,4:-1/2,5:-1/2}, 1: {2:-1/2,6:-1/2}, 2: {3:-1/2,7:-1/2}, 3: {4:-1/2,8:-1/2}, 4: {9:-1/2}, 5: {7:-1/2, 8:-1/2}, 6: {8:-1/2,9:-1/2}, 7: {9:-1/2}} G = Graph(data=d, weighted=True) #G.plot(edge_labels=True).show() bounds = {0:[0,3], 1:[0,3],2:[0,3],3:[0,3],4:[0,3],5:[0,3],6:[0,3],7:[0,3],8:[0,3],9:[0,3]} H = G.degree_constrained_subgraph(bounds) if(H): H.plot(edge_labels=True).show() else: print "No subgraph matches given bounds."