From bffc7df07e2345b19ade6ce2e9718aa3b1bf6a23 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 5 Jan 2006 16:48:55 +0000 Subject: Remove more unneccessary nodes in SLF networks. --- src/GF/Speech/Graph.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/GF/Speech/Graph.hs') 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 -- cgit v1.2.3