0 | module Data.Graph.Indexed.Ring.Bonds 1 | 2 | import Data.SortedSet 3 | import Data.Graph.Indexed 4 | import Data.Graph.Indexed.Ring.Util 5 | import Data.Graph.Indexed.Subgraph 6 | 7 | %default total 8 | 9 | parameters {k : Nat} 10 | (g : IGraph k e n) 11 | 12 | ||| Adds the edges of a subgraph to an edge set 13 | export 14 | addEdges : EdgeSet k -> Subgraph k e n -> EdgeSet k 15 | addEdges x (G o h) = 16 | foldl (\s,(E a b _) => addEdge s (origin h a) (origin h b)) x $ edges h 17 | 18 | ||| Computes the cyclic bonds in a graph. 19 | ||| 20 | ||| This justs collects the edges from the biconnected components. 21 | export 22 | ringBonds : EdgeSet k 23 | ringBonds = foldl addEdges empty (biconnectedComponents g) 24 |