A 3-partite community detection algorithm