Skip to content

Instantly share code, notes, and snippets.

@cbeust
Last active February 7, 2017 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbeust/96675447b3799a8e909bfd35090b131b to your computer and use it in GitHub Desktop.
Save cbeust/96675447b3799a8e909bfd35090b131b to your computer and use it in GitHub Desktop.
class Node(val value: String,
val children: List<Node> = emptyList())
fun displayGraph(roots: List<Node>, indent: String = “”) {
roots.forEach {
println(indent + it.value)
displayGraph(it.children, indent + “ “)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment