diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-07-12 21:44:14 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-07-12 21:44:14 +0200 |
commit | 88e2760d9964b84ea6f9959df693181448680c2d (patch) | |
tree | ef1572d8d7d0523f758486899d45dd07a022c867 /src/Codec/Pesto/Graph.lhs | |
parent | 25ef5b881b125bf372cc44067d352065fdbcf962 (diff) | |
download | pesto-88e2760d9964b84ea6f9959df693181448680c2d.tar.gz pesto-88e2760d9964b84ea6f9959df693181448680c2d.tar.bz2 pesto-88e2760d9964b84ea6f9959df693181448680c2d.zip |
graph: incoming/outgoing with nodes
Diffstat (limited to 'src/Codec/Pesto/Graph.lhs')
-rw-r--r-- | src/Codec/Pesto/Graph.lhs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Codec/Pesto/Graph.lhs b/src/Codec/Pesto/Graph.lhs index fea51a7..c8d17ef 100644 --- a/src/Codec/Pesto/Graph.lhs +++ b/src/Codec/Pesto/Graph.lhs @@ -6,8 +6,10 @@ Language semantics > module Codec.Pesto.Graph ( > toGraph > , walkRoot -> , outgoing -> , incoming +> , outgoingEdges +> , outgoingNodes +> , incomingEdges +> , incomingNodes > , firstNodeId > , resolveReferences > , test @@ -247,9 +249,11 @@ Find graph’s root node(s), that is a node without outgoing edges: Get all nodes with edges pointing towards nodeid -> incoming edges (nodeid, _) = filter ((==) nodeid . snd) edges +> incomingEdges edges (nodeid, _) = filter ((==) nodeid . snd) edges +> incomingNodes nodes edges n = map ((!!) nodes . fst) $ incomingEdges edges n -> outgoing edges (nodeid, _) = filter ((==) nodeid . fst) edges +> outgoingEdges edges (nodeid, _) = filter ((==) nodeid . fst) edges +> outgoingNodes nodes edges n = map ((!!) nodes . snd) $ outgoingEdges edges n > test = ["graph" ~: testGraph, "ref" ~: testRef, "extract" ~: testExtract] |