Zog.Community.Dendrogram (Zog v0.1.0)

View Source

Hierarchical community structure from algorithms like Louvain, Leiden.

Summary

Functions

Get partition with approximately n communities.

Get the coarsest partition (fewest communities).

Get the finest partition (most communities).

Backward compatibility: convert from legacy map format.

Get partition at a specific level index.

Creates a new dendrogram from a list of community levels.

Creates a new dendrogram with merge order tracking.

Get the number of hierarchical levels.

Convert to legacy map format.

Types

t()

@type t() :: %Zog.Community.Dendrogram{
  levels: [Zog.Community.Result.t()],
  merge_order: [{non_neg_integer(), non_neg_integer()}],
  metadata: map()
}

Functions

at_level(dendrogram, n)

@spec at_level(t(), non_neg_integer()) :: Zog.Community.Result.t() | nil

Get partition with approximately n communities.

coarsest(dendrogram)

@spec coarsest(t()) :: Zog.Community.Result.t()

Get the coarsest partition (fewest communities).

finest(dendrogram)

@spec finest(t()) :: Zog.Community.Result.t()

Get the finest partition (most communities).

from_map(map)

@spec from_map(map()) :: t()

Backward compatibility: convert from legacy map format.

get_level(dendrogram, index)

@spec get_level(t(), non_neg_integer()) :: Zog.Community.Result.t() | nil

Get partition at a specific level index.

new(levels)

@spec new([Zog.Community.Result.t()]) :: t()

Creates a new dendrogram from a list of community levels.

new(levels, merge_order)

Creates a new dendrogram with merge order tracking.

num_levels(dendrogram)

@spec num_levels(t()) :: non_neg_integer()

Get the number of hierarchical levels.

to_map(dendrogram)

@spec to_map(t()) :: map()

Convert to legacy map format.