Get the index of a node by its ID
int getNodeIndex(String nodeId) { return nodes.indexWhere((node) => node.id == nodeId); }