First implementation of who knows who, using map and power_semi_group