# first, delete existing windows to save memory:
  deleteAllWindows(CytoscapeConnection())
  cw <- CytoscapeWindow ('invertNodeSelection demo', graph=makeSimpleGraph())
  displayGraph (cw)
  layoutNetwork (cw, 'force-directed')
  invertNodeSelection (cw)
     # all nodes should be selected, since none were before
  invertNodeSelection (cw)
     # no node should be selected, since all were before
  selectNodes (cw, 'A')
  invertNodeSelection (cw)
    # only B and C should be selected
Run the code above in your browser using DataLab