summaryrefslogtreecommitdiff
path: root/src/GF/Speech/Graph.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-01-05 16:48:55 +0000
committerbringert <bringert@cs.chalmers.se>2006-01-05 16:48:55 +0000
commitbffc7df07e2345b19ade6ce2e9718aa3b1bf6a23 (patch)
treee091ac825932d3b638a3bd9aca599f1c12e86db5 /src/GF/Speech/Graph.hs
parent12187f684e063bbc6da17308b33ec48985ae3aad (diff)
Remove more unneccessary nodes in SLF networks.
Diffstat (limited to 'src/GF/Speech/Graph.hs')
-rw-r--r--src/GF/Speech/Graph.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/GF/Speech/Graph.hs b/src/GF/Speech/Graph.hs
index 689880799..d018756d7 100644
--- a/src/GF/Speech/Graph.hs
+++ b/src/GF/Speech/Graph.hs
@@ -17,6 +17,7 @@ module GF.Speech.Graph ( Graph(..), Node, Edge, NodeInfo
, removeNodes
, nodeInfo
, getIncoming, getOutgoing, getNodeLabel
+ , inDegree, outDegree
, edgeFrom, edgeTo, edgeLabel
, reverseGraph, renameNodes
) where
@@ -109,6 +110,12 @@ getIncoming i n = let (_,inc,_) = lookupNode i n in inc
getOutgoing :: Ord n => NodeInfo n a b -> n -> [Edge n b]
getOutgoing i n = let (_,_,out) = lookupNode i n in out
+inDegree :: Ord n => NodeInfo n a b -> n -> Int
+inDegree i n = length $ getIncoming i n
+
+outDegree :: Ord n => NodeInfo n a b -> n -> Int
+outDegree i n = length $ getOutgoing i n
+
getNodeLabel :: Ord n => NodeInfo n a b -> n -> a
getNodeLabel i n = let (l,_,_) = lookupNode i n in l