# Problem 80a

Convert from a graph from graph-term to adjacency-list representation. (See Graphs for details on these formats.)

## Example

``````graph80 = ( [ 'b', 'c', 'd', 'f', 'g', 'h', 'k' ],
[ ('b','c'), ('b','f'), ('c','f'), ('f','k'), ('g','h') ] )

[ ('b',['c','f'])
, ('c',['b','f'])
, ('d',[])
, ('f',['b','c','k'])
, ('g',['h'])
, ('h',['g'])
, ('k',['f'])
]

``````

## Unit Test

``````import Html
import List
import Set

type alias Edge comparable = (comparable, comparable)
type alias AdjList comparable = (List((comparable, List comparable)))
type alias Graph comparable = (List comparable, List (Edge comparable))

[]

main =
Html.text
(if (test) then
else
"Your implementation failed at least one test."
)

test : Bool
test =
List.all ((==) True)
, [] == graphToAdjList ([], [])
]

graph80 = ( [ 'b', 'c', 'd', 'f', 'g', 'h', 'k' ],
[ ('b','c'), ('b','f'), ('c','f'), ('f','k'), ('g','h') ] )

[ ('b',['c','f'])
, ('c',['b','f'])
, ('d',[])
, ('f',['b','c','k'])
, ('g',['h'])
, ('h',['g'])
, ('k',['f'])
]
``````

## Hints

1. `Set.fromList` and `Set.toList` may come in handy.

Solution