# HG changeset patch
# User Minh Van Nguyen <nguyenminh2@gmail.com>
# Date 1273560560 25200
# Node ID 5502dc2c69176dff5dd5dca4148b4ad4e2a9bf29
# Parent cfd7af5f5e6e1fa0dcdb494e33b0f507d364f04e
#8892: reviewer patch: many doctests fails since the update of NetworkX
diff --git a/sage/graphs/graph.py b/sage/graphs/graph.py
a
|
b
|
|
1429 | 1429 | sage: g = graphs.CycleGraph(6) |
1430 | 1430 | sage: bounds = lambda x: [1,1] |
1431 | 1431 | sage: m = g.degree_constrained_subgraph(bounds=bounds) # optional - requires GLPK or CBC or CPLEX |
1432 | | sage: m.size() # optional - requires GLPK CBC or CPLEX |
| 1432 | sage: m.size() # optional - requires GLPK or CBC or CPLEX |
1433 | 1433 | 3 |
1434 | 1434 | """ |
1435 | 1435 | |
… |
… |
|
1456 | 1456 | |
1457 | 1457 | for v in self: |
1458 | 1458 | minimum,maximum = f_bounds(v) |
1459 | | p.add_constraint(sum([ b[reorder(x,y)]*weight(l) for x,y,l in self.edges_incident(v)]),min=minimum, max=maximum) |
| 1459 | p.add_constraint(sum([ b[reorder(x,y)]*weight(l) for x,y,l in self.edges_incident(v)]), min=minimum, max=maximum) |
1460 | 1460 | |
1461 | 1461 | p.set_objective(sum([ b[reorder(x,y)]*weight(l) for x,y,l in self.edge_iterator()])) |
1462 | 1462 | p.set_binary(b) |
diff --git a/sage/graphs/graph_coloring.py b/sage/graphs/graph_coloring.py
a
|
b
|
|
577 | 577 | color = p.get_values(color) |
578 | 578 | classes = [[] for i in xrange(k)] |
579 | 579 | [classes[i].append(e) |
580 | | for e in g.edge_iterator(labels = False) |
| 580 | for e in g.edge_iterator(labels=False) |
581 | 581 | for i in xrange(k) |
582 | 582 | if color[R(e)][i] == 1] |
583 | 583 | # if needed, builds a dictionary from the color classes adding colors |