Skip to content

Instantly share code, notes, and snippets.

@PavelPenkov
Created October 23, 2013 10:24
Show Gist options
  • Save PavelPenkov/7116146 to your computer and use it in GitHub Desktop.
Save PavelPenkov/7116146 to your computer and use it in GitHub Desktop.
val edges = for(i <- 0 until n; tail <- adj(i)) yield (i, tail)
val reversed = edges.foldLeft(Digraph(n))(_.addEdge(_))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment