@Override
	public void setGraph(AttributedGraph graph, GraphDisplayOptions options, String title,
			boolean append, TaskMonitor monitor) {
		setGraphDisplayOptions(options);
		if (append && Objects.equals(title, this.title) && this.graph != null) {
			graph = mergeGraphs(graph, this.graph);
		}

		this.title = title;
		componentProvider.setTitle(title);
		int count = graph.getVertexCount();
		if (count > options.getMaxNodeCount()) {
			Msg.showWarn(this, null, "Graph Not Rendered - Too many nodes!", "Exceeded limit of " +
				options.getMaxNodeCount() + " nodes.\n\n  Graph contained " + count + " nodes!");
			graph = new AttributedGraph("Aborted", graph.getGraphType(), "Too Many Nodes");
			graph.addVertex("1", "Graph Aborted");
		}
		doSetGraphData(graph);
		graphCollapser = new GhidraGraphCollapser(viewer);
		buildHighlighers();
	}
configure a preferred size based on the size of the graph to display
Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java