Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Numerical</strong> <strong>Optimization</strong>, Release 6.1.1<br />
•params – params – An optional dict containing the edge parameters (see meth:add_edge). If<br />
this parameter is not provided, all edges connecting u and v are deleted. Otherwise only edges with<br />
matching parameters are deleted.<br />
See Also:<br />
delete_edges()<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: edges = [("A", "B", {"low":0.0, "cap":10.0, "cost":5})]<br />
sage: edges.append(("A", "B", {"low":0.0, "cap":15.0, "cost":10}))<br />
sage: edges.append(("B", "C", {"low":0.0, "cap":20.0, "cost":1}))<br />
sage: edges.append(("B", "C", {"low":0.0, "cap":10.0, "cost":20}))<br />
sage: gbe.add_edges(edges)<br />
sage: gbe.delete_edge("A", "B")<br />
sage: gbe.delete_edge("B", "C", {"low":0.0, "cap":10.0, "cost":20})<br />
sage: print gbe.edges()[0][0], gbe.edges()[0][1], gbe.edges()[0][2][’cost’]<br />
B C 1.0<br />
delete_edges(edges)<br />
Deletes edges from the graph.<br />
Non existing edges are ignored.<br />
INPUT:<br />
•edges – An iterable container of edges.<br />
See Also:<br />
delete_edge()<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: edges = [("A", "B", {"low":0.0, "cap":10.0, "cost":5})]<br />
sage: edges.append(("A", "B", {"low":0.0, "cap":15.0, "cost":10}))<br />
sage: edges.append(("B", "C", {"low":0.0, "cap":20.0, "cost":1}))<br />
sage: edges.append(("B", "C", {"low":0.0, "cap":10.0, "cost":20}))<br />
sage: gbe.add_edges(edges)<br />
sage: gbe.delete_edges(edges[1:])<br />
sage: len(gbe.edges())<br />
1<br />
sage: print gbe.edges()[0][0], gbe.edges()[0][1], gbe.edges()[0][2][’cap’]<br />
A B 10.0<br />
delete_vertex(vert)<br />
Removes a vertex from the graph.<br />
Trying to delete a non existing vertex will raise an exception.<br />
INPUT:<br />
•vert – The name (as str) of the vertex to delete.<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: verts = ["A", "D"]<br />
5.3. GLPK Backend for access to GLPK graph functions 85