code: function visit(rootNodes, graph) {
      const result = {};
      const queue = rootNodes;
      rootNodes.forEach((node) => {
          result[node] = true;
      });
      while (queue.length > 0) {
          const el = queue.shift();
          const myEdges = graph[el] || [];
          myEdges.forEach((toNode) => {
              if (!result[toNode]) {
                  result[toNode] = true;
                  queue.push(toNode);
              }
          });
      }
      return result;
  }
docs: Return a set of reachable nodes in `graph` starting from `rootNodes`