connected-components
Version: 4.2.1.5

Connected Components

Jay McCarthy <jay at plt-scheme dot org>

Finds the connected components of a graph.

 (require (planet jaymccarthy/connected))

(connected-components nodes    
  node->edges    
  edge->node)  (listof (listof any/c))
  nodes : (listof any/c)
  node->edges : (any/c . -> . (listof any/c))
  edge->node : (any/c . -> . any/c)

Returns a list of lists of nodes. Each node list represents a connected component of the graph induced by nodes, node->edges, and edge->node. These are provided as procedures rather than data structures to be more general.

Refer to "test.ss" for a short example.