code: def output_to_trivialgraph(file, namer=_trivialgraph_default_namer, block=None):
      
      graph = net_graph(block)
      node_index_map = {}  # map node -> index
  
      # print the list of nodes
      for index, node in enumerate(graph):
          print('%d %s' % (index, namer(node, is_edge=False)), file=file)
          node_index_map[node] = index
  
      print('#', file=file)
  
      # print the list of edges
      for _from in graph:
          for _to in graph[_from]:
              from_index = node_index_map[_from]
              to_index = node_index_map[_to]
              edge = graph[_from][_to]
              print('%d %d %s' % (from_index, to_index, namer(edge)), file=file)
docs: Walk the block and output it in trivial graph format to the open file.