summaryrefslogtreecommitdiff
path: root/src/Grasp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Grasp')
-rw-r--r--src/Grasp/Types.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Grasp/Types.hs b/src/Grasp/Types.hs
index 72f835a..af43d51 100644
--- a/src/Grasp/Types.hs
+++ b/src/Grasp/Types.hs
@@ -1,6 +1,7 @@
module Grasp.Types (
GraspProgram(..),
+ namedNodes,
nodesWithName,
normalise,
iso
@@ -28,6 +29,18 @@ instance (Ord a, Ord b) => Eq (Gr a b) where
+namedNodes :: GraspProgram -> [LNode String]
+namedNodes g =
+ let nodes = Graph.labNodes g
+ edges = Graph.labEdges g
+
+ nameEdges = filter (\(_,_,z) -> z == "name") edges
+ nameNodes = map (\(x,_,_) -> x) nameEdges
+
+ in filter (\(x,_) -> x `elem` nameNodes) nodes
+
+
+
nodesWithName :: GraspProgram -> String -> [LNode String]
nodesWithName g s =
let nodes = Graph.labNodes g