https://github.com/bansallab/modular_graph_generator

An algorithm that generates random graphs with a specified modularity.

https://github.com/bansallab/modular_graph_generator

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

An algorithm that generates random graphs with a specified modularity.

Basic Info
  • Host: GitHub
  • Owner: bansallab
  • Language: Python
  • Default Branch: master
  • Size: 358 KB
Statistics
  • Stars: 7
  • Watchers: 8
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created over 12 years ago · Last pushed over 6 years ago
Metadata Files
Readme

README.md

Random Modular Network Generator

This is the source code used for the following paper:

Sah, Pratha*, Lisa O. Singh, Aaron Clauset, and Shweta Bansal. "Exploring community structure in biological networks with random graphs." BMC Bioinformatics 2014, 15:220. doi:10.1186/1471-2105-15-220

This Python script generates undirected, simple, connected graphs with a specified degrees and pattern of communities, while maintaining a graph structure that is as random as possible.

email: ps875@georgetown.edu, sb753@georgetown.edu

Please cite the paper above, if you use our code in any form or create a derivative work.

Sample Output Graph

alt tag

Modular random graphs with network size = 150, 375 edges, 3 modules (or communities) of size, s = 50 and degree distribution is power law with modularity values of: a) Q = 0.1; b) Q = 0.3; and c) Q = 0.6.

From Figure 2, Sah et al. (2014)

Dependencies

Link to install Networkx can be found here. The generator also requires sequence_generator.py script which is provided.

Usage

For a quick demo of the code, open the script "randommodulargeneratorvariablemodules.py" and scroll down to the main function. Adjust the model parameters, degree distribution function and module size distribution function and run in terminal using the command:

$ python random_modular_generator_variable_modules.py

Sample Code

For users unfamiliar to Python, I have uploadeded a sample code file (mock_code.py) demonstrating how the graph generator can be imported and used in a script. The mock code can be run using the command

$ python mock_code.py

Output

The code saves the the adjacency matrix of the generated random modular graph under the filename 'adjacencymatrix.txt'. The graph is also saved in a graphml format under the filename "randommodular_graph.graphml". The graphml file can be uploaded in Gephi (http://gephi.github.io/) for graph visualization. Note that Gephi currently does not have a layout plugin to visualize modular graphs. In the near future, I am planning to add a function in random-modular-network-generator.py code to assign each node a particular coordinate that allows easy visualization of modules (I have done this in Figure 2). Shoot us an email if you need this feature sooner than later.

=========

Owner

  • Name: Bansal Lab
  • Login: bansallab
  • Kind: organization
  • Location: Georgetown University, Washington DC

GitHub Events

Total
  • Pull request event: 1
  • Fork event: 1
Last Year
  • Pull request event: 1
  • Fork event: 1