void ClearGraph() { // Set entry point's guid back from the save. Discard existing guid. nodes.Find(x => x.entryPoint).guid = _containerCache.nodeLinks[0].baseNodeGuid; foreach (var node in nodes) { if (node.entryPoint) { continue; } // Remove the edges connected to this node edges.Where(x => x.input.node == node).ToList(). ForEach(edge => _targetGraphView.RemoveElement(edge)); // And then remove the node _targetGraphView.RemoveElement(node); } }