private ProgramSelection makeSelectionFromVertex(boolean forwardFlow, Function function,
			Program program, ProgramLocation location, TaskMonitor monitor)
			throws CancelledException {

		Graph<CodeBlockVertex, CodeBlockEdge> graph = createGraph(function, program, monitor);
		CodeBlockVertex from = getVertex(location, graph);

		GDirectedGraph<CodeBlockVertex, CodeBlockEdge> dg = asDirectedGraph(graph);
		Set<CodeBlockVertex> dominated;
		if (forwardFlow) {
			dominated = GraphAlgorithms.findDominance(dg, from, monitor);
		}
		else {
			dominated = GraphAlgorithms.findPostDominance(dg, from, monitor);
		}

		Collection<CodeBlock> blocks = generateCodeBlocksFromVertices(dominated);
		ProgramSelection selection = makeSelectionFromCodeBlocks(blocks, program);
		return selection;
	}
This plugin class contains the structure needed for the user to select code
blocks that are only reachable by following the flow from the current program
location (they are unreachable from any other starting point).
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByScopedFlowPlugin.java