Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created July 11, 2019 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save md2perpe/a61a1c892187a4a4d0bbc353b43c582c to your computer and use it in GitHub Desktop.
Save md2perpe/a61a1c892187a4a4d0bbc353b43c582c to your computer and use it in GitHub Desktop.
def load_graph():
g = {}
with open('sample.txt', 'r') as f:
for line in filter(lambda l: l != '\n', f):
row = line.split('\t')
g[int(row[1])] = list(map(int, row[2:]))
return g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment