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.


1 Answer 1


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.

  • $\begingroup$ Pathways aren’t exactly directed graphs. There are different relationships (inhibition, enhancement,...) how to build a netwrokx’s graph out of it isn’t clear. And that is my main issue, how to build a graph given a KEGG pathway. $\endgroup$
    – 0x90
    Commented Jan 29, 2020 at 12:18
  • $\begingroup$ Basically my original question is how to transfer a KEGG pathway to a networkx object? $\endgroup$
    – 0x90
    Commented Jan 29, 2020 at 15:16
  • $\begingroup$ Inhibition and enhancement would be weights with different signs. For more complicated interactions standard graph representations simply wouldn't suffice. $\endgroup$
    – Devon Ryan
    Commented Jan 29, 2020 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.