Skip to main content

Python Random Graph Generator

Project description


Random Graph Generator

PyPI version Codecov built with Python3


Table of contents

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.

Open Hub
PyPI Counter
Github Stars
Branch master dev
Travis
AppVeyor
Code Quality CodeFactor

Installation

Source Code

  • Download Version 0.7 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

Conda

Exe Version (Only Windows)

System Requirements

Pyrgg will likely run on a modern dual core PC. Typical configuration is:

  • Dual Core CPU (2.0 Ghz+)
  • 4GB of RAM

Note that it may run on lower end equipment though good performance is not guaranteed.

Usage

Issues & Bug Reports

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

TODO

  • Formats
    • DIMACS
    • JSON
    • YAML
    • Pickle
    • CSV
    • TSV
    • WEL
    • ASP
    • TGF
    • UCINET DL
    • GEXF
  • Sizes
    • Small
    • Medium
    • Large
  • Weighted Graph
    • Signed Weights
  • Unweighted Graph
  • 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. 1. Rand Graph Generation

  • Generate synthetic data for graph benchmark suite like GAP

Supported Formats

  • DIMACS(.gr)

     	p sp <number of vertices> <number of edges>
     	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>
    
  • TSV(.tsv)

     	<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	
    
  • Matrix Market(.mtx)

        %%MatrixMarket matrix coordinate real general
        <number of vertices>  <number of vertices>  <number of edges>
        <head_1>    <tail_1>    <weight_1> 
        .
        .
        .
        <head_n>    <tail_n>    <weight_n> 
    
  • Graph Line(.gl)

        <head_1> <tail_1>:<weight_1> <tail_2>:<weight_2>  ... <tail_n>:<weight_n>
        <head_2> <tail_1>:<weight_1> <tail_2>:<weight_2>  ... <tail_n>:<weight_n>
        .
        .
        .
        <head_n> <tail_1>:<weight_1> <tail_2>:<weight_2>  ... <tail_n>:<weight_n>
    
  • Pickle(.p) (Binary Format)

Similar Works

Dependencies

master dev
Requirements Status Requirements Status

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}
}
JOSS
Zenodo DOI

License

References

DIMACS

Donate to our project

Bitcoin :

1XGr9qbZjBpUQJJSB6WtgBQbDTgrhPLPA

Payping (For Iranian citizens) :

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.7 - 2020-08-07

Added

  • Graph Line format

Changed

  • Menu optimized

0.6 - 2020-07-24

Added

  • Matrix Market format

Changed

  • json_maker function optimized
  • dl_maker function optimized
  • tgf_maker function optimized
  • lp_maker function optimized

0.5 - 2020-07-01

Added

  • TSV format
  • Multigraph control

Changed

0.4 - 2020-06-17

Added

  • Self loop control
  • Github action

Changed

  • appveyor.yml updated

0.3 - 2019-11-29

Added

  • __version__ variable
  • CHANGELOG.md
  • dev-requirements.txt
  • requirements.txt
  • CODE_OF_CONDUCT.md
  • ISSUE_TEMPLATE.md
  • PULL_REQUEST_TEMPLATE.md
  • CONTRIBUTING.md
  • version_check.py
  • pyrgg_profile.py
  • Unweighted graph
  • Undirected graph
  • Exe version

Changed

  • Test system modified
  • README.md modified
  • Docstrings modified
  • get_input function modified
  • edge_gen function modified
  • Parameters moved to params.py

0.2 - 2017-09-20

Added

  • CSV format
  • YAML format
  • Weighted edge list format (WEL)
  • ASP format
  • Trivial graph format (TGF)
  • UCINET DL format
  • Pickle format

0.1 - 2017-08-19

Added

  • DIMACS format
  • JSON format
  • README

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrgg-0.7.tar.gz (237.2 kB view hashes)

Uploaded Source

Built Distribution

pyrgg-0.7-py2.py3-none-any.whl (21.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page