Help Implement Feature Into Graph - Folding / Collapsing

Hello, I have just built a graph using a python program that writes DOT. My graph is very wide right now and I would love the ability to collapse it. In order to do so I feel like all I would need to do is have it then when I click on a node it inserts "#" (comment out) in the DOT code and thus hides the nodes. Clicking on the single node would then remove the #. Right now when I click on a node it takes me to that node's URL (i.e, when I click on facebook.com it takes me to facebook.com). so I know there is some kind of code that recognizes when a node has been clicked. Does anyone know how I would modify this action? Or even better, have an idea of how I could change the source file? Thanks!

I am interested in

I am interested in foldable/collapsable graphs. Any success with that?

Help Implement Feature Into

You are somewhat at the mercy of the python program. Without knowing what it does, it is hard to say how to tailor it.
In general, you would have to write the function that does what you want, and then attach a call to this function, via a cgi-bin script or a javascript, depending on how you are viewing the graph.
     Emden