code: func decodeGraph(r io.Reader) (*marshalGraph, error) {
  	dec := json.NewDecoder(r)
  
  	// a stream should always start with a graph
  	g := &marshalGraph{}
  
  	err := dec.Decode(g)
  	if err != nil {
  		return nil, err
  	}
  
  	// now replay any operations that occurred on the original graph
  	for dec.More() {
  		s := &streamDecode{}
  		err := dec.Decode(s)
  		if err != nil {
  			return g, err
  		}
  
  		// the only Type we're concerned with here is Transform to complete the
  		// Graph
  		if s.Type != typeTransform {
  			continue
  		}
  
  		t := &marshalTransform{}
  		err = json.Unmarshal(s.JSON, t)
  		if err != nil {
  			return g, err
  		}
  		t.Transform(g)
  	}
  	return g, nil
  }
docs: // decodeGraph decodes a marshalGraph from an encoded graph stream.