blob: 86cabdc103f68aa1c9c9cc4b6f2530dd3ecceb53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
module Library.Cost(
cost,
nodeCost,
listCost
) where
import Data.Maybe
import Data.Graph.Inductive.Graph( Node )
import qualified Data.Graph.Inductive.Graph as Graph
import Library.ProofGraph
cost :: String -> Int
cost x = 1
nodeCost :: PGraph -> Node -> Int
nodeCost graph node =
let label = fromJust (Graph.lab graph node)
nextCostLayer = map (nodeCost graph) (Graph.suc graph node)
in (cost label) + (sum nextCostLayer)
listCost :: [String] -> Int
listCost = sum . (map cost)
|