private List<FlowArrow> getFlowArrowsForScreenInstructions(AddressSetView screenAddresses) {

		List<FlowArrow> results = new ArrayList<>();
		ArrowCache arrowCache = new ArrowCache();
		CodeUnitIterator it = program.getListing()
				.getCodeUnitIterator(CodeUnit.INSTRUCTION_PROPERTY, screenAddresses, true);

		while (it.hasNext()) {
			CodeUnit cu = it.next();
			Instruction instruction = (Instruction) cu;

			// incoming
			int refCount = program.getReferenceManager().getReferenceCountTo(cu.getMinAddress());
			if (refCount < MAX_REFSTO_SHOW) {
				ReferenceIterator instructionIt = instruction.getReferenceIteratorTo();
				while (instructionIt.hasNext()) {
					Reference ref = instructionIt.next();
					createFlowArrow(results, arrowCache, ref);
				}
			}

			arrowCache.clear();

			// outgoing
			Reference[] refs = instruction.getReferencesFrom();
			for (Reference ref : refs) {
				createFlowArrow(results, arrowCache, ref);
			}

		}

		return results;
	}
Calculates depth based on all other arrows that DO NOT share an endpoint
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/flowarrow/FlowArrowPlugin.java