Graph<Integer> (PsiParameter[] parameters, PsiExpression[] arguments) { final InboundSemiGraph<Integer> graph = new InboundSemiGraph<>() { @NotNull @Override public Collection<Integer> getNodes() { final List<Integer> result = new ArrayList<>(); for (int i = 0; i < parameters.length; i++) { result.add(i); } return result; } @NotNull @Override public Iterator<Integer> getIn(Integer n) { final List<Integer> result = new ArrayList<>(); final PsiParameter target = parameters[n]; for (int i = 0, length = arguments.length; i < length; i++) { if (i == n) continue; if (VariableAccessUtils.variableIsUsed(target, arguments[i])) { result.add(i); } } return result.iterator(); } }; return GraphGenerator.generate(CachingSemiGraph.cache(graph)); }