private static String layoutGraph(Function function, FGController controller,
			FunctionGraph functionGraph, TaskMonitor monitor) throws CancelledException {

		if (!performSwingThreadRequiredWork(functionGraph, monitor)) {
			return null;// shouldn't happen
		}

		monitor.setMessage("Performing graph layout...");
		FGLayoutProvider layoutProvider = controller.getLayoutProvider();

		try {
			FGLayout layout = layoutProvider.getLayout(functionGraph, monitor);
			functionGraph.setGraphLayout(layout);
			return null;
		}
		catch (CancelledException ce) {
			throw ce;
		}
		catch (Exception e) {
			Msg.error(FunctionGraphFactory.class,
				"Exception performing graph layout for function " + function, e);
			controller.setStatusMessage("Problem performing graph layout--try another layout");
		}

		//
		// Setup a default/dummy layout
		//
		functionGraph.setGraphLayout(new EmptyLayout(functionGraph));

		return "Problem performing graph layout using the \"" + layoutProvider.getLayoutName() +
			"\" (try another layout)";
	}
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