Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parseFile(filename):
- file = open(filename)
- for line in f:
- #reg helps parse file
- #\s matches single whitespace character
- #\d matches digit
- reg = re.match( r'(\d+)\s(\d+)', str(line))
- #all matching subgroups in a tuple
- i = int(reg.group(1))
- j = int(reg.group(2))
- #Containers for the graph, graphReverse
- g = []
- gR = []
- while(len(g) < i):
- g.append([])
- g[i-1].append(j)
- while(len(gR) < j):
- gR.append([])
- gR[j-1].append(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement