Skip to content

Instantly share code, notes, and snippets.

@maxekman
Created September 13, 2013 14:45
Show Gist options
  • Save maxekman/6551680 to your computer and use it in GitHub Desktop.
Save maxekman/6551680 to your computer and use it in GitHub Desktop.
An example of how to use github.com/looplab/tarjan
graph := make(map[interface{}][]interface{})
graph["1"] = []interface{}{"2"}
graph["2"] = []interface{}{"3"}
graph["3"] = []interface{}{"1"}
graph["4"] = []interface{}{"2", "3", "5"}
graph["5"] = []interface{}{"4", "6"}
graph["6"] = []interface{}{"3", "7"}
graph["7"] = []interface{}{"6"}
graph["8"] = []interface{}{"5", "7", "8"}
output := Connections(graph)
fmt.Println(output)
// Output:
// [[3 2 1] [7 6] [5 4] [8]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment