#13698: Access to graph routines of the GLPK
------------------------------------------------------------------------+---
       Reporter:  christiankuper                                        |       
  Owner:  jason, jkantor
           Type:  enhancement                                           |       
 Status:  needs_review  
       Priority:  major                                                 |     
Milestone:  sage-5.7      
      Component:  numerical                                             |    
Resolution:                
       Keywords:  out-of-kilter, minflow, maxflow, critical path, GLPK  |   
Work issues:                
Report Upstream:  N/A                                                   |     
Reviewers:                
        Authors:  Christian Kuper                                       |     
Merged in:                
   Dependencies:                                                        |      
Stopgaps:                
------------------------------------------------------------------------+---

Comment (by ncohen):

 Two quick things :
 * Why do you keep a pointer toward Sage's graph ``self.sage_graph`` ?
 There are several problem with this design : the graph may be modified by
 the user, while you keep a pointer toward a graph that gets modified.
 Secondly, as it seems you only need it for two methods, you might as well
 give the graph as a parameter to those two methods, and get rid of the
 parameter.
 *  Don't do this :
     {{{
     sage: from sage.numerical.backends.glpk_graph_backend \
 import GLPKGraphBackend
 }}}
     If you *need* to split lines, do it this way :
     {{{
     sage: from sage.numerical.backends.glpk_graph_backend \
     ...      import GLPKGraphBackend
 }}}

     But you really shouldn't split lines so often. It' meant to make code
 easier to read (a least I believe it is), but sometimes it really doesn't
 help. As they appear really often, I think that you should let this line
 stay even if it is very long. Besides, you very often don't need to add a
 terinal `\`. For instance, this :

         {{{
         830                     return (u, v, {"low":(<c_a_data
 *>a.data).low, \
         831                                    "cap":(<c_a_data
 *>a.data).cap, \
         832                                    "cost":(<c_a_data
 *>a.data).cost, \
         833                                    "x":(<c_a_data
 *>a.data).x})
 }}}

     Can be replaced by

         {{{
         830                     return (u, v, {"low":(<c_a_data
 *>a.data).low,
         831                                    "cap":(<c_a_data
 *>a.data).cap,
         832                                    "cost":(<c_a_data
 *>a.data).cost,
         833                                    "x":(<c_a_data
 *>a.data).x})
 }}}
     It works, because Python knows the line is not finished : some
 parenthesis are still open at this step, and it's waiting for `}` and `)`.

 Nathann

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13698#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to