Representing Graph Clusters (Communities)
A data structure used in the Louvain algorithm to track clusters of nodes in a graph, or communities.
Interface
To use this module, prefix types and functions with Community..
Types
type t- The type of a community.
Methods
val make : int -> tval numSet : t -> intval normalize : t -> unitval whichSet : (t * int) -> intval sameSet : (t * int * int) -> boolval merge : t * (int * int) list -> boolval equal : (t * t) -> boolval getSetMember : (t * int) -> int list
Method Overview
make size- Creates a set of
sizecommunities, each with a single member. The communities and members are each represented by integers.
- Creates a set of
numSet commu- Returns the number of communities.
normalize commu- Renames the identifiers, so that they are integers starting from 0. This
modifies
commu.
- Renames the identifiers, so that they are integers starting from 0. This
modifies
whichSet (commu, id)- Returns the community that
idbelongs to.
- Returns the community that
sameSet (commu, id1, id2)- Returns true if
id1andid2are in the same community and false otherwise.
- Returns true if
merge (commu, l)- Merge the communities indicated in the list. If any community membership is changed return true, otherwise return false.
equal (commu1, commu2)- Returns true if the two communities are equal and false otherwise.
getSetMember (commu, id)- Return all elements in the same community as the given member.