Skip to content

Commit

Permalink
allow getting edges
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Feb 8, 2022
1 parent 22f432a commit 6955053
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Graph.elm
@@ -1,4 +1,4 @@
module Graph exposing (Graph, empty, insertEdge, insertNode, neighbors, node, nodes, updateEdge)
module Graph exposing (Graph, edgesFrom, empty, insertEdge, insertNode, neighbors, node, nodes, updateEdge)

import Dict exposing (Dict)

Expand Down Expand Up @@ -66,6 +66,11 @@ nodes (Graph guts) =
guts.nodes


edgesFrom : Int -> Graph node edge -> Maybe (Dict Int edge)
edgesFrom id (Graph guts) =
Dict.get id guts.edges


neighbors : Int -> Graph node edge -> Maybe (Dict Int edge)
neighbors id (Graph { edges }) =
Dict.get id edges

0 comments on commit 6955053

Please sign in to comment.