Compact storage for coocurrence matrix construction