Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections.abc import *
- from functools import reduce
- def print_arcs(graph: Mapping[Set]):
- def redFn1(acc, elem):
- def redFn2(acc2, elem2):
- print(f"{elem}->{elem2}")
- reduce(redFn2, graph[elem], None)
- reduce(redFn1, graph, None)
- g = {
- 'a': {'b', 'c', 'c'},
- 'ef': {'c'},
- 'c': {'b'}
- }
- print_arcs(g)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement