The RI, NMI and conductance metrics are implemented using Cython. Note that conductance is implemented for unweighted and undirected graph. There are example graph and community files under the data/ directory.
The code works for both python2 and python3
git clone https://github.com/alamages/cls-metrics.git
cd cls-metrics
make
The code supports undirected unweighted graphs. The input graph must be provided in this format:
[node_id] [neighbor_id1] [neighbor_id2] ....
The node ids must appear in an increasing sequence starting from index 1 up to n (where n is the number of nodes). Same with the neighbor ids.
Same for the community/cluster files the node ids must appear in an increasing sequence, the format is:
[node_id] [community_id]
Examples of input files can be found under the data/ folder.
# to print the scripts' arguments use -h/--help argument:
./conductance.py -h
# conductance:
./conductance.py -g data/graph -c data/clusters
# ri and nmi metrics:
./ri_nmi.py -g data/community -c data/clusters