🔧 Python Random Graph Generator
Switch branches/tags
Clone or download

README.md


Random Graph Generator

PyPI version DOI Codecov built with Python3

Overview

Pyrgg is an easy-to-use synthetic random graph generator written in Python which supports various graph file formats including DIMACS .gr files. Pyrgg has the ability to generate graphs of different sizes and is designed to provide input files for broad range of graph-based research applications, including but not limited to testing, benchmarking and performance-analysis of graph processing frameworks. Pyrgg target audiences are computer scientists who study graph algorithms and graph processing frameworks.

Installation

Source Code

  • Download Version 0.2 or Latest Source
  • pip install -r requirements.txt or pip3 install -r requirements.txt (Need root access)
  • python3 setup.py install or python setup.py install (Need root access)

PyPI

Usage


pyrgg output

Fig. 1. DIMACS .gr output format

Test

python3 -m pyrgg test or python -m pyrgg test

This test run automatically in each commit ;-)

Linux Windows
pyrgg test

Issues & Bug Reports

Just fill an issue and describe it. I'll check it ASAP! or send an email to sepand@qpage.ir.

TODO

  • Formats
    • DIMACS
    • JSON
    • YAML
    • Pickle
    • CSV
    • WEL
    • ASP
    • TGF
    • UCINET DL
  • Sizes
    • Small
    • Medium
    • Large
  • Weighted Graph
    • Signed Weights
  • Dense Graph
  • Sparse Graph
  • Directed Graph
  • Self loop
  • Parallel Arc
  • Multithreading
  • GUI
  • Erdős–Rényi model
  • Tree

Sample Files

Example Of Usage

  • Generate synthetic data for graph processing frameworks (some of them mentioned here) performance-analysis

Fig. 2. Rand Graph Generation

  • Generate synthetic data for graph benchmark suite like GAP

Supported Formats

  • DIMACS(.gr)

     	p sp <number of vertices> <number of directed edge>
     	a <head_1> <tail_1> <weight_1>
    
     	.
     	.
     	.
     	
     	a <head_n> <tail_n> <weight_n>
    
  • CSV(.csv)

     	<head_1>,<tail_1>,<weight_1>
    
     	.
     	.
     	.
     	
     	<head_n>,<tail_n>,<weight_n>
    
  • JSON(.json)

     	{
     	"graph": {
     			"nodes":[
     			{
     				"id": "1"
     			},
    
     			.
     			.
     			.
     			{
     				"id": "n"
     			}
     			],
     			"edges":[
     			{
     				"source": "head_1",
     				"target": "tail_1",
     				"weight": "weight_1"
     			},
    
     			.
     			.
     			.
    
     			{
     				"source": "head_n",
     				"target": "tail_n",
     				"weight": "weight_n"
     			},
     			]
     		}
     	}
    
  • YAML(.yaml)

     	graph:
     		edges:
     		- source: "head_1"
     	  	target: "tail_1"
     	  	weight: "weight_1"
     	
     		.
     		.
     		.
    
     		- source: "head_n"
     	  	target: "tail_n"
     	  	weight: "weight_n"
     					
     		nodes:
     		- id: '1'
    
     		.
     		.
     		.
    
     		- id: 'n'
    
    
  • Weighted Edge List(.wel)

     	<head_1> <tail_1> <weight_1>
     	
     	.
     	.
     	.
     	
     	<head_n> <tail_n> <weight_n>	
    
  • ASP(.lp)

     	node(1).
     	.
     	.
     	.
     	node(n).
     	edge(head_1,tail_1,weight_1).
     	.
     	.
     	.
     	edge(head_n,tail_n,weight_n).
    
  • Trivial_Graph_Format(.tgf)

     	1
     	.
     	.
     	.
     	n
     	#
     	1 2 weight_1
     	.
     	.
     	.
     	n k weight_n
    
  • UCINET DL Format(.dl)

     	dl
     	format=edgelist1
     	n=<number of vertices>
     	data:
     	1 2 weight_1
     	.
     	.
     	.
     	n k weight_n	
    
  • Pickle(.p) (Binary Format)

Contribution

You can fork the repository, improve or fix some part of it and then send the pull requests back if you want to see them here. I really appreciate that. ❤️

Remember to write a few tests for your code before sending pull requests.

Similar Works

Citing

If you use pyrgg in your research , please cite the JOSS paper ;-)

@article{Haghighi2017,
  doi = {10.21105/joss.00331},
  url = {https://doi.org/10.21105/joss.00331},
  year  = {2017},
  month = {sep},
  publisher = {The Open Journal},
  volume = {2},
  number = {17},
  author = {Sepand Haghighi},
  title = {Pyrgg: Python Random Graph Generator},
  journal = {The Journal of Open Source Software}
}

License

Reference

DIMACS

Donate to our project

Beerpay :

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

Bitcoin :

1XGr9qbZjBpUQJJSB6WtgBQbDTgrhPLPA

Payping (For Iranian citizens) :