Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 457 Bytes

ch06-04.md

File metadata and controls

26 lines (17 loc) · 457 Bytes

6.4 Implementing the graph

  • 👉 Read "Grokking Algorithms"

  • 🐍 python practice

# Graph (using Hash table)

graph = {}
graph[“you”] = [“alice”, “bob”, “claire”]
graph[“bob”] = [“anuj”, “peggy”]
graph[“alice”] = [“peggy”]
graph[“claire”] = [“thom”, “jonny”]
graph[“anuj”] = []
graph[“peggy”] = []
graph[“thom”] = []
graph[“jonny”] = []

# test graph
print(graph)