I am currently writing a program to model Dijkstra's algorithm, however I am having some trouble the graph in its current form below:
G = [['a', 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h', 'i', 'j'],
[({'a', 'b'}, 4), ({'a', 'c'}, 6), ({'a', 'd'}, 8), ({'b', 'e'}, 1) ,
({'b', 'f'}, 9), ({'c', 'f'}, 2), ({'d', 'g'}, 7), ({'d', 'h'}, 1) ,
({'e', 'i'}, 2), ({'e', 'j'}, 7), ({'g', 'h'}, 2), ({'i', 'j'}, 4)]]
I want to get the graph in the form such as the one below
{ 'a': {'b': 4, 'c': 6, 'd': 8},
'b': {'a': 4, 'e': 1, 'f': 9}, etc
Would this be possible?