Skip to main content

DEMON - Overlapping Community Discovery.

Test and Coverage (Ubuntu) Coverage Status pyversions PyPI version Updates DOI PyPI download month

DEMON logo

Community discovery in complex networks is an interesting problem with a number of applications, especially in the knowledge extraction task in social and information networks. However, many large networks often lack a particular community organization at a global level. In these cases, traditional graph partitioning algorithms fail to let the latent knowledge embedded in modular structure emerge, because they impose a top-down global view of a network. We propose here a simple local-first approach to community discovery, able to unveil the modular organization of real complex networks. This is achieved by democratically letting each node vote for the communities it sees surrounding it in its limited view of the global system, i.e. its ego neighborhood, using a label propagation algorithm; finally, the local communities are merged into a global collection.

Note: Demon has been integrated within CDlib a python package dedicated to community detection algorithms, check it out!

Citation

If you use our algorithm please cite the following works:

Coscia, Michele; Rossetti, Giulio; Giannotti, Fosca; Pedreschi, Dino "Uncovering Hierarchical and Overlapping Communities with a Local-First Approach" ACM Transactions on Knowledge Discovery from Data (TKDD), 9 (1), 2014.

Coscia, Michele; Rossetti, Giulio; Giannotti, Fosca; Pedreschi, Dino "DEMON: a Local-First Discovery Method for Overlapping Communities" SIGKDD international conference on knowledge discovery and data mining, pp. 615-623, IEEE ACM, 2012, ISBN: 978-1-4503-1462-6.

Installation

In order to install the package just download (or clone) the current project and copy the demon folder in the root of your application.

Alternatively use pip:

pip install demon

or conda

conda install -c giuliorossetti demon

Demon is written in python and requires the following package to run:

  • networkx
  • tqdm

Implementation details

Execution

The algorithm can be used as standalone program as well as integrated in python scripts.

Standalone

python demon filename epsilon -c min_com_size

where:

  • filename: edgelist filename
  • epsilon: merging threshold in [0,1]
  • min_community_size: minimum size for communities (default 3 - optional)

Demon results will be saved on a text file.

Input file specs

Edgelist format: tab separated edgelist (nodes represented with integer ids).

Row example:

node_id0    node_id1

As python library

Demon can be executed specifying as input:

  1. an edgelist file
import demon as d
dm = d.Demon(network_filename="filename.tsc", epsilon=0.25, min_community_size=3, file_output="communities.txt")
dm.execute()
  1. a networkx Graph object
import networkx as nx
import demon as d

g = nx.karate_club_graph()
dm = d.Demon(graph=g, epsilon=0.25, min_community_size=3)
coms = dm.execute()

The parameter file_output, if specified, allows to write on file the algorithm results. Conversely, the communities will be returned to the main program as a list of node ids tuple, e.g.,

[(0,1,2),(3,4),(5,6,7)]

Metadata

Release files for demon 2.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demon 2.0.6
File Size Uploaded
demon-2.0.6.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for demon 2.0.6
File Interpreter ABI Platform
demon-2.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / demon-2.0.6.tar.gz

Download URL demon-2.0.6.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
60e5d85aaf039172770e58bb4e989287b672d8008a83d66b8e722c273d38a359
BLAKE2b-256 checksum
How to use checksums
490121337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / demon-2.0.6-py3-none-any.whl

Download URL demon-2.0.6-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dc023c9d2a8550a4039c4c46f02153c467a7ccce9144e38a1ea0d5b0054e362
BLAKE2b-256 checksum
How to use checksums
96855f9146e3f8d7324d8741cd3bea9b99926d5ee75571b9610c661b1bbd06f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

2.0.6 This release

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

3 release files

2.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page