I found a solution for deleting the isolated nodes. First you find the degree matrix for every node. The elements which have a degree of zero are isolated nodes. Therefore your next move is to find the indexes of those elements and the delete them from the graph:
Best Answer