Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/nofib/spectral/scc/Main.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


-- !!! strongly-connected components of a graph
-- (courtesy mainly of John Launchbury)

import Digraph

main = print (stronglyConnComp edges vertices)
  where
    -- here's a test graph: Figure 6.4 from SLPJ 87
    a, b, c, d, f, g, h :: Int
    a = 1
    b = 2
    c = 3
    d = 4
    f = 5
    g = 6
    h = 7
    vertices = [a,b,c,d,f,g,h]
    edges = [(b, a),
	     (c, b),
	     (c, d),
	     (c, h),
	     (d, c),
	     (f, a),
	     (f, g),
	     (f, h),
	     (g, f),
	     (h, g)]

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].