areNodesConnected method

bool areNodesConnected(
  1. String sourceNodeId,
  2. String targetNodeId
)

Checks if two nodes are connected

Implementation

bool areNodesConnected(String sourceNodeId, String targetNodeId) {
  return connections.any(
    (conn) =>
        conn.sourceNodeId == sourceNodeId &&
        conn.targetNodeId == targetNodeId,
  );
}