File: index.rst.txt

package info (click to toggle)
python-louvain 0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 964 kB
  • sloc: javascript: 8,547; python: 605; makefile: 89
file content (146 lines) | stat: -rw-r--r-- 5,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
.. Community detection for NetworkX documentation master file, created by
   sphinx-quickstart on Fri Jan 15 11:13:59 2010.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.



.. toctree::
   :maxdepth: 3

   api.rst



Community detection for NetworkX's documentation
=================================================
This module implements community detection.


It uses the louvain method described in
Fast unfolding of communities in large networks,
Vincent D Blondel, Jean-Loup Guillaume, Renaud Lambiotte, Renaud Lefebvre,
Journal of Statistical Mechanics: Theory and Experiment 2008(10), P10008 (12pp)

It depends on Networkx to handle graph operations :
http://networkx.lanl.gov/

The program can be found in a repository where you can also report bugs :

.. raw:: html

    <a href="https://github.com/taynaud/python-louvain">https://github.com/taynaud/python-louvain</a>




Example :
=========

As a command line utility :
-------------------------
You should consider using the cpp version at
http://findcommunities.googlepages.com/ !

./community.py file.bin > tree



where file.bin is a binary graph as generated by the convert utility of the cpp
version.

The generated file can then be used with the hierarchy utility of the cpp version.
Note that the program does not make many verifications about the arguments,
and is expecting a friendly use.

As python module :
------------------

::

    import community as community_louvain
    import matplotlib.cm as cm
    import matplotlib.pyplot as plt
    import networkx as nx

    # load the karate club graph
    G = nx.karate_club_graph()

    #first compute the best partition
    partition = community_louvain.best_partition(G)

    # compute the best partition
    partition = community_louvain.best_partition(G)

    # draw the graph
    pos = nx.spring_layout(G)
    # color the nodes according to their partition
    cmap = cm.get_cmap('viridis', max(partition.values()) + 1)
    nx.draw_networkx_nodes(G, pos, partition.keys(), node_size=40,
                           cmap=cmap, node_color=list(partition.values()))
    nx.draw_networkx_edges(G, pos, alpha=0.5)
    plt.show()




Changelog :
===========

* 2020-12-27 : 0.15, Stop relabelling stable partitions, tests on power, doc fixes
* 2020-04-06 : 0.14, bugfixes (on resolution parameter), optimization on random state
* 2018-12-21 : 0.13, better random state, some files missing included, communities always in 0..N-1
* 2018-05-22 : 0.11, stop forcing networkx<2.0 and expose module __version__
* 2018-01-02 : 0.10, bug fix: taking into account the node removal cost
* 2017-09-21 : 0.9, support networkx 2.0
* 2017-06-03 : 0.8, add randomization and bugfixes
* 2017-05-21 : 0.7, migrate to github, readthedocs and travis. Add resolution parameter to control community size, bugfixes
* 04/21/2011 : modifications to use networkx like documentation and use of test.
* 02/22/2011 : correction of a bug regarding edge weights
* 01/14/2010 : modification to use networkx 1.01 graph api and adding the possibility to start the algorithm with a given partition
* 04/10/2009 : increase of the speed of the detection by caching node degrees



License :
=========
.. raw:: html

    Copyright (c) 2009, Thomas Aynaud &lt;<a href="mailto:thomas.aynaud@lip6.fr">thomas.aynaud@lip6.fr</a>&gt;<br>
    All rights reserved.<br><br>

    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:<br><br>

    * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.<br><br>

    * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.<br><br>

    * Neither the name of the python-louvain Developers nor the names of its
    contributors may be used to endorse or promote products derived from this
    software without specific prior written permission.<br><br><br>



    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`