Wolfram Research

Function Repository Resource:

PartitionByCooccurence

Source Notebook

Find the best-fitting partitions for a list of groups using co-occurrence counts

Contributed by: Ryan Bell

ResourceFunction["PartitionByCooccurence"][subgroups]

partitions the subgroups list based on the co-occurrence frequency of list items.

Details and Options

This function is used to partition a collection of items into subgroups based on the co-occurrence frequency of the list items.

Examples

Basic Examples

For all the elements in a set of lists, find a set of disjoint subsets containing all the elements:

In[1]:=
ResourceFunction[
 "PartitionByCooccurence"][{{1, 2, 3, 4}, {1, 2}, {3, 4}}]
Out[1]=

Applications

Self-assembling communities

Suppose you have a list of user IDs that are conversing on different threads. On one thread, there is a discussion among users {"Alice","Bob","Carol","Dan"}, on another thread between {"Alice","Bob"} and on a third thread, users {"Carol","Dan"} are chatting. Using this information, find the best way to organize all participants into groups based on these self-assembling communities:

In[2]:=
ResourceFunction[
 "PartitionByCooccurence"][{{"Alice", "Bob", "Carol", "Dan"}, {"Alice", "Bob"}, {"Carol", "Dan"}}]
Out[2]=

Resource History

Source Metadata

Related Resources

License Information