@Override
  public @NotNull <Node> Graph<Node> invertEdgeDirections(final @NotNull Graph<Node> graph) {
    return new Graph<Node>() {
      @Override
      public @NotNull Collection<Node> getNodes() {
        return graph.getNodes();
      }

      @Override
      public @NotNull Iterator<Node> getIn(final Node n) {
        return graph.getOut(n);
      }

      @Override
      public @NotNull Iterator<Node> getOut(final Node n) {
        return graph.getIn(n);
      }
    };
  }
@Override
  public @NotNull <Node> Graph<Node> invertEdgeDirections(final @NotNull Graph<Node> graph)