@Nonnull
		private CallGraphItem buildCallGraph(@Nonnull MethodMember rootMethod, @Nonnull Function<MethodVertex, Collection<MethodVertex>> childrenGetter) {
			ArrayDeque<MethodMember> visitedMethods = new ArrayDeque<>();
			ArrayDeque<List<CallGraphItem>> workingStack = new ArrayDeque<>();
			CallGraphItem root = new CallGraphItem(rootMethod, false);
			workingStack.push(new ArrayList<>(Set.of(root)));
			int depth = 0;
			while (!workingStack.isEmpty()) {
				List<CallGraphItem> todo = workingStack.peek();
				if (!todo.isEmpty()) {
					final CallGraphItem item = todo.removeLast();
					if (item.recursive)
						continue;
					visitedMethods.push(item.getValue());
					depth++;
					final MethodVertex vertex = callGraph.getVertex(item.getValue());
					if (vertex != null) {
						final List<CallGraphItem> newTodo = childrenGetter.apply(vertex).stream()
								.filter(c -> c.getResolvedMethod() != null)
								.map(c -> {
									MethodMember cm = c.getResolvedMethod();
									return new CallGraphItem(cm, visitedMethods.contains(cm));
								})
								.filter(i -> {
									if (i.getValue() == null) return false;
									Lists.sortedInsert(Unchecked.cast(item.getChildren()), i);
									return !i.recursive;
								}).collect(Collectors.toList());
						if (!newTodo.isEmpty() && depth < MAX_TREE_DEPTH) {
							workingStack.push(newTodo);
						} else visitedMethods.pop();
					}
					continue;
				}
				workingStack.pop();
				if (!visitedMethods.isEmpty()) visitedMethods.pop();
				depth--;
			}
			return root;
		}
Cell of a class in the hierarchy.
recaf-ui/src/main/java/software/coley/recaf/ui/control/graph/MethodCallGraphPane.java