# first, delete existing windows to save memory:
deleteAllWindows(CytoscapeConnection())
cy <- CytoscapeConnection ()
title <- 'createWindowFromSelection demo'
cw <- CytoscapeWindow (title, makeSimpleGraph ())
displayGraph (cw)
layoutNetwork (cw)
selectNodes (cw, c ('A', 'C'))
new.window.title <- 'NEW WINDOW'
c2 <- createWindowFromSelection (cw, new.window.title, TRUE)
layoutNetwork (c2, 'force-directed')
print (getEdgeCount(c2)) # should be 1
Run the code above in your browser using DataLab