code: def to_triples(self, short_pred=True, properties=True):
          
          node_triples, edge_triples = [], []
          # sort nodeids just so top var is first
          nodes = sorted(self.nodes(), key=lambda n: n.nodeid != self.top)
          for node in nodes:
              nid = node.nodeid
              pred = node.pred.short_form() if short_pred else node.pred.string
              node_triples.append((nid, 'predicate', pred))
              if node.lnk:
                  node_triples.append((nid, 'lnk', '"{}"'.format(str(node.lnk))))
              if node.carg:
                  node_triples.append((nid, 'carg', '"{}"'.format(node.carg)))
              if properties:
                  if node.cvarsort is not None:
                      node_triples.append((nid, 'type', node.cvarsort))
                  props = node.properties
                  node_triples.extend((nid, p, v) for p, v in props.items())
              edge_triples.extend(
                  (nid, rargname, tgt)
                  for rargname, tgt in sorted(
                      self.edges(nid).items(),
                      key=lambda x: rargname_sortkey(x[0])
                  )
              )
          return node_triples + edge_triples
docs: Encode the Eds as triples suitable for PENMAN serialization.