old_contents: #!/usr/bin/env python
  import igraph
  import json
  import sys
  import attributes
  
  if(len(sys.argv) == 1):
      print('You need to supply a JSON file.')
      exit(1)
  
  # Get the contents of the relevant file
  j = json.load(open(sys.argv[1], 'r'))
  
  # Initialize the graph with n = nodes in the input file
  g = igraph.Graph(0, directed=True)
  
  # Add all of the vertices, so that there are no unknown objects. They
  # are named according to their name in the JSON
  i = 0
  for name, node in j.items():
      
      print "Adding vertex: " + name
      g.add_vertex(name)
  
      # Now, g.vs[i] refers to the most recent vertex
      attributes.apply(g.vs[i], name, node)
      i += 1
      
  
  # Add the edges by iterating through the "connected" field of the
  # Node, and adding an edge in the graph for each
  for name, node in j.items():
      # This needs to be wrapped in a try/except block, because it will
      # fail if node["connected"] doesn't exist
      try:
          for target in node["connected"]:
              print "Adding edge: " + name + "--" + target
              g.add_edge(name, target)
      except Exception:
          pass
  
  # Finally, plot the graph
  fig = igraph.Plot(bbox=(480, 480), background="white")
  fig.add(g, layout="fr")
  fig.show()
  
new_contents: #!/usr/bin/env python
  import igraph
  import json
  import sys
  import attributes
  
  # Constants
  bbox = (600, 600)
  directedness = True
  background = "white"
  
  if(len(sys.argv) == 1):
      print('You need to supply a JSON file.')
      exit(1)
  
  # Get the contents of the relevant file
  j = json.load(open(sys.argv[1], 'r'))
  
  # Initialize the graph with n = nodes in the input file
  g = igraph.Graph(0, directed=directedness)
  
  # Add all of the vertices, so that there are no unknown objects. They
  # are named according to their name in the JSON
  i = 0
  for name, node in j.items():
      
      print "Adding vertex: " + name
      g.add_vertex(name)
  
      # Now, g.vs[i] refers to the most recent vertex
      attributes.apply(g.vs[i], name, node)
      i += 1
      
  
  # Add the edges by iterating through the "connected" field of the
  # Node, and adding an edge in the graph for each
  for name, node in j.items():
      # This needs to be wrapped in a try/except block, because it will
      # fail if node["connected"] doesn't exist
      try:
          for target in node["connected"]:
              print "Adding edge: " + name + "--" + target
              g.add_edge(name, target)
      except Exception:
          pass
  
  # Make sure all edges are straight
  g.es["curved"] = 0
  # Adjust the bounding box, to avoid cutting labels.
  g.layout().fit_into(bbox=bbox)
  
  # Finally, plot the graph
  igraph.plot(g, bbox=bbox, background=background)
  
subject: Fix graph cropping and arrow curvature