private static BidiMap<CodeBlock, FGVertex> createVertices(Function function,
			final FGController controller, TaskMonitor monitor) throws CancelledException {

		BidiMap<CodeBlock, FGVertex> vertices = new DualHashBidiMap<>();
		CodeBlockModel blockModel = new BasicBlockModel(controller.getProgram());

		AddressSetView addresses = function.getBody();
		CodeBlockIterator iterator = blockModel.getCodeBlocksContaining(addresses, monitor);
		monitor.initialize(addresses.getNumAddresses());

		for (; iterator.hasNext();) {
			CodeBlock codeBlock = iterator.next();

			FlowType flowType = codeBlock.getFlowType();
			boolean isEntry = isEntry(codeBlock);
			Address cbStart = codeBlock.getFirstStartAddress();
			if (cbStart.equals(function.getEntryPoint())) {
				isEntry = true;
			}

			FGVertex vertex =
				new ListingFunctionGraphVertex(controller, codeBlock, flowType, isEntry);
			vertices.put(codeBlock, vertex);

			long blockAddressCount = codeBlock.getNumAddresses();
			long currentProgress = monitor.getProgress();
			monitor.setProgress(currentProgress + blockAddressCount);
		}

		return vertices;
	}
Creates a new function graph for the given function

@param function the function to graph
@param controller the controller needed by the function graph
@param program the function's program
@param monitor the task monitor
@return the new graph
@throws CancelledException if the task is cancelled via the monitor
Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/FunctionGraphFactory.java