Added documentation to CommunitySet and handled some TODOs.

TODOs handled: implemented __len__, improved performance of the
code, enforced community indices between 0 and N.