title: Cytoscape.js collapse all incoming and outgoing nodes
body: <p>I've seen this example <a href="https://gist.github.com/maxkfranz/aedff159b0df05ccfaa5" rel="nofollow">Images and breadthfirst layout</a> where the clicked node collapses the outgoing nodes. I want to collapse all outgoing as well as incoming nodes. I've tried to write another (similar) method which uses source in place of the target (in the original method).</p>
  
  <p>I then try to call the two methods in succession, but the code always hangs. Could you please tell me how should I collapse all (incoming/outgoing) nodes?</p>