# How to represent pathways as mathematical graphs?

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.

Pathways are generally directed graphs, which can be implemented in python using the networkx package. Note that there will be cycles in graphs.