Gabow

Finds the strongly connected components of a directed graph with one depth-first search and two stacks, without the lowlink values of Tarjan's algorithm.

Time complexity O(V+E), gograph function connectivity.Gabow.

Microservice calls

Nine services of an online shop. Each edge is a call from one service to another, and some services call each other back.

A directed graph with 9 vertices and 15 edges.

Which groups of services call each other in a loop, so that each service in a group depends on all the others?

Use it in Go

for _, component := range connectivity.Gabow(g) {
	var names []string
	for _, v := range component {
		names = append(names, v.Label())
	}
	fmt.Println(strings.Join(names, ", "))
}

Example graphs

More in Connectivity

  • Tarjan: Finds the strongly connected components of a directed graph, the groups of vertices that can all reach each other, with one depth-first search.
  • Kosaraju: Finds the strongly connected components of a directed graph with two depth-first searches, the second on the graph with every edge reversed.

All algorithms