Module cluster_dict

Implements a data type that congregates and manages clusters of nodes.

Copyright © (C) 2015, Pablo Lamela, Simon Thompson

Authors: Pablo Lamela Seijas (P.Lamela-Seijas@kent.ac.uk), Simon Thompson (S.J.Thompson@kent.ac.uk).

Description

Implements a data type that congregates and manages clusters of nodes. It relies on the internal data type cluster.

Data Types

cluster_dict()

abstract datatype: cluster_dict(Node)

Function Index

extract_trivial_clusters/1 Removes clusters with only one node from the cluster dictionary.
get_cluster_for_node/2 Finds the cluster that has the Node in the ClusterDict.
growing_map_fold/3 Mapfolds a function through a clusters dictionary.
merge_cluster/2 Adds a Cluster to the ClusterDict and merges the new Cluster with the clusters with common nodes in ClusterDict.
new/0 Creates a new empty cluster dictionary.
show_cluster_dict/1 Returns a more readable version of custer dictionaries.
show_cluster_dict/2 Returns a more readable version of custer dictionaries and takes a function that is suppoused to make the nodes in the clusters more readable.

Function Details

extract_trivial_clusters/1

extract_trivial_clusters(Cluster_dict::cluster_dict(NodeType)) -> {[cluster:cluster(NodeType)], cluster_dict(NodeType)}

Removes clusters with only one node from the cluster dictionary. It returns a list with the removed clusters.

get_cluster_for_node/2

get_cluster_for_node(Node::N, Cluster_dict::cluster_dict(N)) -> {ok, Cluster::cluster:cluster(N)} | error

Finds the cluster that has the Node in the ClusterDict.

growing_map_fold/3

growing_map_fold(Fun::fun((cluster:cluster(N), Acc) -> {[cluster:cluster(N)], none | cluster:cluster(N), Acc}), Acc, Cluster_dict::cluster_dict(N)) -> {cluster_dict(N), Acc}

Mapfolds a function through a clusters dictionary. As opposed to the traditional mapfold, this one expects an extra element in the returned tuple, (the first one), which specifies which new clusters must be map_folded later, (in addition to the original ones from the cluster dictionary). The updated cluster (second element of the tuple returned by the function), can be the atom none, this means that the Cluster will not be in the resulting list.

merge_cluster/2

merge_cluster(Cluster::cluster:cluster(N), ClusterDict::cluster_dict(N)) -> cluster_dict(N)

Adds a Cluster to the ClusterDict and merges the new Cluster with the clusters with common nodes in ClusterDict.

new/0

new() -> cluster_dict(any())

Creates a new empty cluster dictionary.

show_cluster_dict/1

show_cluster_dict(Clus::cluster_dict(term())) -> #{}

Returns a more readable version of custer dictionaries. This is done by transforming dicts and sets into lists.

show_cluster_dict/2

show_cluster_dict(Fun::fun((NodeType) -> any()), Cluster_dict::cluster_dict(NodeType)) -> #{}

Returns a more readable version of custer dictionaries and takes a function that is suppoused to make the nodes in the clusters more readable. This is done by transforming dicts and sets into lists and by applying the supplied function to the nodes.


Generated by EDoc, Nov 5 2015, 16:30:18.