text: user734: I would like to construct a mathematical graph: $G = (E,V, w(E))$ a graph with vertices, edges with weight on them based on a KEGG pathway.  
  Is there a way to do that with existing tools? If not I will start to implement a Python module for that. My main question is what is the mathematical graph representation of pathways? Assuming the possible node types and the different connections? 
  I would like to transform a pathway to a graph because then one can run min-cut-max-flow algorithms and stuff like that as part of my pathway analysis. 
  
  user77: Pathways are generally directed graphs, which can be implemented in python using the networkx package. Note that there will be cycles in graphs.
  Please note that there are large numbers of pathways analysis packages that already exist (both python and R packages but also just webservers), so I strongly recommend searching to see if something already exists before wasting time and implementing it yourself.
  
original_text: 734: <p>I would like to construct a mathematical graph: <span class="math-container">$G = (E,V, w(E))$</span> a graph with vertices, edges with weight on them <a href="https://www.biostars.org/p/85763/" rel="nofollow noreferrer">based on a KEGG pathway</a>.  </p>
  
  <p>Is there a way to do that with existing tools? If not I will start to implement a Python module for that. My main question is what is the mathematical graph representation of pathways? Assuming the possible node types and the different connections? </p>
  
  <p>I would like to transform a pathway to a graph because then one can run min-cut-max-flow algorithms and stuff like that as part of my <a href="https://en.wikipedia.org/wiki/Pathway_analysis" rel="nofollow noreferrer">pathway analysis</a>. </p>
   77: <p>Pathways are generally directed graphs, which can be implemented in python using the <code>networkx</code> package. Note that there will be cycles in graphs.</p>
  
  <p>Please note that there are large numbers of pathways analysis packages that already exist (both python and R packages but also just webservers), so I strongly recommend searching to see if something already exists before wasting time and implementing it yourself.</p>
  