Update compaction algorithm to remove @graph from output when it is empty and the only member

See https://github.com/json-ld/json-ld.org/issues/99#issuecomment-5048471 and the discussion in 87a4681c35748ff92d2912e2fc480ca957c5cf5f.