a hierachical clustering algorithm based on information theory
pip install info-cluster
After installing info-cluster
package, you can use it as follows:
from info_cluster import InfoCluster
import networkx as nx
g = nx.Graph() # undirected graph
g.add_edge(0, 1, weight=1)
g.add_edge(1, 2, weight=1)
g.add_edge(0, 2, weight=5)
ic = InfoCluster(affinity='precomputed') # use precomputed graph structure
ic.fit(g)
ic.print_hierarchical_tree()
The output is like
/-0
/-|
--| \-2
|
\-1