code: def to_dict(self, properties=True):
          
          nodes = {}
          for node in self.nodes():
              nd = {
                  'label': node.pred.short_form(),
                  'edges': self.edges(node.nodeid)
              }
              if node.lnk is not None:
                  nd['lnk'] = {'from': node.cfrom, 'to': node.cto}
              if properties:
                  if node.cvarsort is not None:
                      nd['type'] = node.cvarsort
                  props = node.properties
                  if props:
                      nd['properties'] = props
              if node.carg is not None:
                  nd['carg'] = node.carg
              nodes[node.nodeid] = nd
          return {'top': self.top, 'nodes': nodes}
docs: Encode the Eds as a dictionary suitable for JSON serialization.