mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-29 13:00:32 +01:00
5339c24f35
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
98 lines
3.2 KiB
Text
98 lines
3.2 KiB
Text
[License: LGPL v3] [build]
|
||
|
||
Multi-criteria community detection library
|
||
|
||
This library makes the Louvain community detection system
|
||
significantly easier to use. Example code:
|
||
|
||
#include "louvain_communities/louvain_communities.h" #include
|
||
<iostream>
|
||
|
||
int main(int /*argc*/, char** /*argv*/) { LouvainC::Communities
|
||
graph;
|
||
|
||
//First community graph.add_edge(1, 2, 2L);
|
||
graph.add_edge(1, 3, 2L); graph.add_edge(1, 4, 2L);
|
||
graph.add_edge(2, 3, 2L); graph.add_edge(2, 4, 2L);
|
||
graph.add_edge(3, 4, 2L);
|
||
|
||
//Second community graph.add_edge(4, 5, 2L);
|
||
graph.add_edge(4, 6, 2L); graph.add_edge(4, 7, 2L);
|
||
graph.add_edge(5, 6, 2L); graph.add_edge(5, 7, 2L);
|
||
graph.add_edge(6, 7, 2L);
|
||
|
||
//Weak connection between 1st and 2nd communities
|
||
graph.add_edge(1, 4, 0.1L);
|
||
|
||
//Calculate communities gplain.calculate(true);
|
||
|
||
//Get community mapping auto r = gplain.get_mapping();
|
||
for(auto& vert_to_comm: r) { std::cout << "Vertext " <<
|
||
vert_to_comm.first << " is in community " << vert_to_comm.second <<
|
||
std::endl; } }
|
||
|
||
How to build
|
||
|
||
To build:
|
||
|
||
git clone https://github.com/meelgroup/louvain-community cd
|
||
louvain-community mkdir build && cd build cmake .. make -j4 sudo
|
||
make install
|
||
|
||
In case you are going to use the system in another cmake based
|
||
project, you don’t even need to install. In these cases, you can
|
||
look for the library in your CMakeLists.txt file via:
|
||
|
||
find_package(louvain_communities CONFIG) if
|
||
(louvain_communities_FOUND) message(STATUS "Found Louvain
|
||
Communities library") message(STATUS "Louvain Communities dynamic
|
||
lib: ${LOUVAIN_COMMUNITIES_LIBRARIES}") message(STATUS "Louvain
|
||
Communities include dirs: ${LOUVAIN_COMMUNITIES_INCLUDE_DIRS}")
|
||
else() message(FATAL_ERROR "Cannot find Louvain Communities
|
||
libraries. Please install it! Exiting.") endif()
|
||
|
||
To compile a static library simply do:
|
||
|
||
git clone https://github.com/meelgroup/louvain-community cd
|
||
louvain-community mkdir build && cd build cmake -DSTATICCOMPILE=ON
|
||
.. make -j4 sudo make install
|
||
|
||
Testing
|
||
|
||
To test:
|
||
|
||
pip install python-louvain
|
||
|
||
git clone https://github.com/jlguillaume/louvain cd louvain make
|
||
-j4
|
||
|
||
git clone https://github.com/meelgroup/louvain-community cd
|
||
louvain-community mkdir build && cd build ln -s ../scritps/* . ln
|
||
-s ../../louvain/louvain . ./mytest.py 50-10-9-q.cnf.gz.no_w.cnf
|
||
awk '{print "gplain.add_edge(" $1 ", " $2 ", " $3 "L);"}' graph.txt
|
||
> ../src/mygraph.cpp cmake -DENABLE_TESTING=ON .. make -j4
|
||
> ./test.sh 50-10-9-q.cnf.gz.no_w.cnf
|
||
|
||
To check how well the communities fit a graph generated via VIG
|
||
(“Variable Incidence Graph”) graph-generation from a DIMACS CNF and
|
||
a layout engine using the spring method:
|
||
|
||
pip install python-louvain git clone
|
||
https://github.com/meelgroup/louvain-community cd louvain-community
|
||
mkdir build && cd build ln -s ../scritps/* . ./mytest.py
|
||
50-10-9-q.cnf.gz.no_w.cnf --draw
|
||
|
||
References
|
||
|
||
Based on Community Detection “Louvain”, version 0.3, from
|
||
SourceForge
|
||
|
||
Based on the article “Fast unfolding of community hierarchies in
|
||
large networks” Copyright (C) 2008 V. Blondel, J.-L. Guillaume, R.
|
||
Lambiotte, E. Lefebvre
|
||
|
||
And based on the article Copyright (C) 2013 R. Campigotto, P. Conde
|
||
Céspedes, J.-L. Guillaume
|
||
|
||
Authors: E. Lefebvre, adapted by J.-L. Guillaume and R. Campigotto,
|
||
Mate Soos
|