areNodesConnected method
Checks if two nodes are connected
Implementation
bool areNodesConnected(String sourceNodeId, String targetNodeId) {
return connections.any(
(conn) =>
conn.sourceNodeId == sourceNodeId &&
conn.targetNodeId == targetNodeId,
);
}