code: function dfs(node) {
  		// visit children, thereby identifying non-immediately dominated nodes
  		for ( const child of node.succ ) {
  			if ( !child.visited ) {
  				// console.log("visit %s->%s (visited:%s)", node.name, child.name, child.visited);
  				dfs(child);
  			}
  		}
  		for ( const child of node.succ ) {
  			if ( child.visited ) {
  				// console.log("delete %s -> %s", node.name, child.name)
  				node.succ.delete(child);
  			} else {
  				child.visited = true;
  			}
  		}
  	}
docs: use DFS to reduce the dominator graph to the (immediate) dominator tree  When after visiting all dominated nodes (=== 'succ'), one of those nodes is not yet marked as immediately dominated (=== 'visited'), then the current node is the immediate dominator, the corresponding edge is kept (otherwise removed) and the child is marked as 'immediately dominated'