converting CSV format data to graph sample format for implementing BFS

import collections   def breadth_first_search(graph, root):      visited, queue = set(), collections.deque([root])     while queue:          vertex = queue.popleft()         for neighbour in graph[vertex]:              if neighbour not in visited:                  visited.add(neighbour)                  queue.append(neighbour)    if __name__ == '__main__':     graph = {0: [1, 2], 1: [2], 2: []}      breadth_first_search(graph, 0) 

I am implementing BFS with the help of given sample data. But here I intend to use my own data. I am extracting graph from Neo4j into CSV format but how do I transform that extracted data into the sample format. Here is some of the sample data from CSV file.

"[{name:Keanu Reeves,born:1964},{roles:[Julian Mercer]},{title:Something's Gotta Give,released:2003}]" "[{name:Keanu Reeves,born:1964},{roles:[Shane Falco]},{title:The Replacements,tagline:Pain heals, Chicks dig scars... Glory lasts forever,released:2000}]" "[{name:Keanu Reeves,born:1964},{roles:[Johnny Mnemonic]},{title:Johnny Mnemonic,tagline:The hottest data on earth. In the coolest head in town,released:1995}]" "[{name:Keanu Reeves,born:1964},{roles:[Kevin Lomax]},{title:The Devil's Advocate,tagline:Evil has its winning ways,released:1997}]"