import json


def parse_graphviz_json(json_string):
  """Parses JSON representation of graphviz graph.

  Args:
    json_string: graphviz graph representation in JSON string format.

  Returns:
    graph in a dictionary format.
  """
  d = json.loads(json_string)
  gv_graph = {}
  node_id_to_name = {}
  for obj in d["objects"]:
    node_id_to_name[obj["_gvid"]] = obj["name"]
    gv_graph[obj["name"]] = list()

  for edge in d["edges"]:
    gv_graph[node_id_to_name[edge["tail"]]].append(
        node_id_to_name[edge["head"]])

  return gv_graph