# Problem 86a Solution
```elm
{-| Given a graph return a graph with the degree of each node correctly set
so we can color the graph with the minimum number of colors
-}
degree : Graph comparable -> Graph comparable
degree ( nodes, edges ) =
let
endPoints =
List.concatMap (\( a, b, w ) -> [ a, b ]) edges
nodes_ =
List.map (\( n, d, c ) -> ( n, (countMembers n endPoints), c )) nodes
in
( nodes_, edges )
countMembers : a -> List a -> Int
countMembers value list =
List.length <| List.filter ((==) value) list
```
[Back to problem](../p/p86.md)