Computer Science
Can someone convert this python code toracket/scheme programming language.
'to', Process finished with exit code 0 if to not in hash_map: # add it to hmap hash_map[to] = set() hash_map[to].add(u) rev g = [] # finally, merge key, value to a single list with same idea as in # original G for k, v in hash_map.items(): rev_g.append ( [k, *v]) return rev_g G = [['a', 'b', 'c'], ['b', 'c', 'e'], ['c', 'b', 'a']] rev_g = reverse_weblink_graph(G) print(*rev_g, sep='\n') "/>
Extracted text: def reverse_weblink_graph(G): ['b', 'a', 'c'] ['c', 'a', "Ь'] ['e', 'b'] hash_map = {} for u, *v in G: # unpacking element of G; U will get first element ['a', 'с'] # and rest goes to list v for to in V: # for each element in v, means a link from 'U' -> 'to', Process finished with exit code 0 if to not in hash_map: # add it to hmap hash_map[to] = set() hash_map[to].add(u) rev g = [] # finally, merge key, value to a single list with same idea as in # original G for k, v in hash_map.items(): rev_g.append ( [k, *v]) return rev_g G = [['a', 'b', 'c'], ['b', 'c', 'e'], ['c', 'b', 'a']] rev_g = reverse_weblink_graph(G) print(*rev_g, sep='\n')