code: def index(self, name, graph):
          
          nodes = graph.nodes()
  
          # Index new nodes.
          new_nodes = list(set(nodes) - set(self.node_index.values()))
          start = max(len(self.node_index) - 1, max(self.node_index.keys()))
          for i in xrange(start, start + len(new_nodes)):
              n = new_nodes.pop()
              self.node_index[i], self.node_lookup[n] = n, i
              self.graphs_containing[n].append(name)
  
          # Relabel nodes in `graph`.
          new_labels = {n: self.node_lookup[n] for n in nodes}
          indexed_graph = nx.relabel.relabel_nodes(graph, new_labels, copy=True)
  
          return indexed_graph
docs: Index any new nodes in `graph`, and relabel the nodes in `graph` using
          the index.
  
          Parameters
          ----------
          name : hashable
              Unique name used to identify the `graph`.
          graph : networkx.Graph
  
          Returns
          -------
          indexed_graph : networkx.Graph