File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Breaking changes:
19
19
20
20
New features:
21
21
- Added ` Foldable ` and ` Traversable ` instances for ` Graph ` (#16 by @MaybeJustJames )
22
+ - Added ` toMap ` to unwrap ` Graph ` (#18 )
22
23
23
24
Bugfixes:
24
25
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Data.Graph
4
4
( Graph
5
5
, unfoldGraph
6
6
, fromMap
7
+ , toMap
7
8
, vertices
8
9
, lookup
9
10
, outEdges
@@ -62,6 +63,11 @@ unfoldGraph ks label edges =
62
63
fromMap :: forall k v . Map k (Tuple v (List k )) -> Graph k v
63
64
fromMap = Graph
64
65
66
+ -- | Create a `Map` which maps vertices to their labels and
67
+ -- | outgoing edges from a `Graph`.
68
+ toMap :: forall k v . Graph k v -> Map k (Tuple v (List k ))
69
+ toMap (Graph g) = g
70
+
65
71
-- | List all vertices in a graph.
66
72
vertices :: forall k v . Graph k v -> List v
67
73
vertices (Graph g) = map fst (M .values g)
You can’t perform that action at this time.
0 commit comments