From 478183f779d752de2bf6f6732e4f76eee462a3b4 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 12:39:54 +0330 Subject: [PATCH 01/61] rename : pythonpublish.yml -> publish.yml. --- .github/workflows/{pythonpublish.yml => publish.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{pythonpublish.yml => publish.yml} (100%) diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/workflows/pythonpublish.yml rename to .github/workflows/publish.yml From cc07b7bedfd31a202ea7077c5b1f75f89b686ace Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 12:44:46 +0330 Subject: [PATCH 02/61] add : requirements-splitter.py added. --- otherfile/requirements-splitter.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 otherfile/requirements-splitter.py diff --git a/otherfile/requirements-splitter.py b/otherfile/requirements-splitter.py new file mode 100644 index 00000000..4d095bbd --- /dev/null +++ b/otherfile/requirements-splitter.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +"""Requirements splitter.""" + +test_req = "" + +with open('dev-requirements.txt', 'r') as f: + for line in f: + if '==' not in line: + test_req += line + +with open('test-requirements.txt', 'w') as f: + f.write(test_req) From a29f05604ad795f88f3b6953cef94b3e96c711d6 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 12:57:17 +0330 Subject: [PATCH 03/61] change : Test system changed. (#87) --- .github/workflows/test.yml | 58 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 45 ----------------------------- .travis/install.sh | 22 --------------- .travis/test.sh | 27 ------------------ appveyor.yml | 44 ----------------------------- 5 files changed, 58 insertions(+), 138 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 .travis/install.sh delete mode 100644 .travis/test.sh delete mode 100644 appveyor.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..8e92d789 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +# This workflow will install Python dependencies, run tests with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: CI + +on: [push, pull_request] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Installation + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + python setup.py install + - name: First test + run: | + python -m pyrgg test + python -m pyrgg + - name: Test requirements Installation + run: | + python otherfile/requirements-splitter.py + pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt + - name: Test with pytest + run: | + python -m pytest test --cov=pyrgg --cov-report=term + - name: Version check + run: | + python otherfile/version_check.py + if: matrix.python-version == 3.7 + - name: Notebook check + run: | + python otherfile/notebook_check.py + if: matrix.os == 'ubuntu-latest' + - name: Other tests + run: | + python -m vulture pyrgg/ otherfile/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size + python -m bandit -r pyrgg -s B311,B403 + python -m pydocstyle -v --match-dir=pyrgg + if: matrix.python-version == 3.7 + - name: Codecov + run: | + codecov + if: matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest' + - name: cProfile + run: | + python -m cProfile -s cumtime otherfile/pyrgg_profile.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 11766d5f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: python - -matrix: - include: - - os: linux - python: 3.8 - dist: xenial - - os: linux - python: 3.7 - dist: xenial - - os: linux - python: 3.6 - - os: linux - python: 3.5 - - os: osx - language: generic - env: TOXENV=py36 - - os: linux - python: 3.7-dev - dist: xenial - - os: linux - python: 3.8-dev - dist: xenial - - os: linux - python: 3.9-dev - dist: xenial - - os: linux - python: nightly - dist: xenial - allow_failures: - - os: linux - python: 3.9-dev - dist: xenial - - os: linux - python: nightly - dist: xenial -install: - - chmod +x .travis/install.sh - - .travis/install.sh -before_script: - - chmod +x .travis/test.sh -script: - - .travis/test.sh -after_success: - - codecov \ No newline at end of file diff --git a/.travis/install.sh b/.travis/install.sh deleted file mode 100644 index 64aebec2..00000000 --- a/.travis/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Dump Environment (so that we can check PATH, UT_FLAGS, etc.) - set -e - set -x - PYTHON_COMMAND=python - PIP_COMMAND=pip - if [ "$TRAVIS_OS_NAME" == "osx" ] - then - PYTHON_COMMAND=python3 - PIP_COMMAND=pip3 - fi - - $PIP_COMMAND install -r requirements.txt - $PYTHON_COMMAND setup.py install - $PYTHON_COMMAND -m pyrgg test - - if [ "$TRAVIS_OS_NAME" == "osx" ] - then - $PIP_COMMAND install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt --user - else - $PIP_COMMAND install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt - fi \ No newline at end of file diff --git a/.travis/test.sh b/.travis/test.sh deleted file mode 100644 index 748e3b2c..00000000 --- a/.travis/test.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Dump Environment (so that we can check PATH, UT_FLAGS, etc.) - set -e - set -x - IS_IN_TRAVIS=false - PYTHON_COMMAND=python - - if [ "$TRAVIS_OS_NAME" == "osx" ] - then - PYTHON_COMMAND=python3 - fi - - if [ "$CI" = 'true' ] && [ "$TRAVIS" = 'true' ] - then - IS_IN_TRAVIS=true - fi - $PYTHON_COMMAND -m pytest test --cov=pyrgg --cov-report=term - if [ "$IS_IN_TRAVIS" = 'false' ] || [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] - then - $PYTHON_COMMAND -m vulture pyrgg setup.py otherfile --min-confidence 65 --sort-by-size - $PYTHON_COMMAND -m bandit -r pyrgg -s B311,B403 - $PYTHON_COMMAND otherfile/version_check.py - $PYTHON_COMMAND -m pydocstyle --match-dir=pyrgg -v - fi - $PYTHON_COMMAND -m cProfile -s cumtime otherfile/pyrgg_profile.py - - \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 1e83f655..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -build: false - -environment: - matrix: - - - PYTHON: "C:\\Python35" - PYTHON_VERSION: "3.5.2" - PYTHON_ARCH: "32" - - PYTHON: "C:\\Python35" - PYTHON_VERSION: "3.5.2" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python37" - PYTHON_VERSION: "3.7.0" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python38" - PYTHON_VERSION: "3.8.0" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python38" - PYTHON_VERSION: "3.8.0" - PYTHON_ARCH: "32" - - PYTHON: "C:\\Python37" - PYTHON_VERSION: "3.7.0" - PYTHON_ARCH: "32" - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6.0" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6.0" - PYTHON_ARCH: "32" - - - -init: - - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" - -install: - - "%PYTHON%/Scripts/pip.exe install -r requirements.txt" - - "%PYTHON%/python.exe setup.py install" - -test_script: - - "%PYTHON%/python.exe -m pyrgg test" - - "%PYTHON%/Scripts/pip.exe install -r dev-requirements.txt" - - "%PYTHON%/python.exe -m pytest test --cov=pyrgg --cov-report=term" - - "%PYTHON%/python.exe otherfile/version_check.py" \ No newline at end of file From 6404484104edac8b2ccd752f433a710e258eb62f Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 12:58:52 +0330 Subject: [PATCH 04/61] log : changes logged. (#87) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fbe2e91..d41fa99a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- `requirements-splitter.py` +### Changed +- Test system modified ## [1.0] - 2021-01-11 ### Added - Number of files option From 953633d0bffd951b73b9ff98b9a1ff44c44927a1 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 13:07:20 +0330 Subject: [PATCH 05/61] remove : pyrgg run removed. --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e92d789..6798bbb6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,6 @@ jobs: - name: First test run: | python -m pyrgg test - python -m pyrgg - name: Test requirements Installation run: | python otherfile/requirements-splitter.py From 33fefd4d06c5f44a614bebdfbfb25e0d97779069 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Wed, 17 Mar 2021 13:09:29 +0330 Subject: [PATCH 06/61] remove : notebook_check removed. --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6798bbb6..08915674 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,10 +38,6 @@ jobs: run: | python otherfile/version_check.py if: matrix.python-version == 3.7 - - name: Notebook check - run: | - python otherfile/notebook_check.py - if: matrix.os == 'ubuntu-latest' - name: Other tests run: | python -m vulture pyrgg/ otherfile/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size From cf82c4c75f776e7aff5379e7a3481d3e11d26987 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Thu, 18 Mar 2021 14:10:58 +0330 Subject: [PATCH 07/61] add : Github Actions badge added. --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8965d41a..abd10903 100644 --- a/README.md +++ b/README.md @@ -66,14 +66,9 @@ Pyrgg target audiences are computer scientists who study graph algorithms and gr dev - Travis - - - - - AppVeyor - - + CI + + From 03d6e329c2f13bef031a08b7d937c1a9665d9b57 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 21 Mar 2021 11:51:30 +0000 Subject: [PATCH 08/61] Bump pyyaml from 5.3.1 to 5.4.1 Bumps [pyyaml](https://github.com/yaml/pyyaml) from 5.3.1 to 5.4.1. - [Release notes](https://github.com/yaml/pyyaml/releases) - [Changelog](https://github.com/yaml/pyyaml/blob/master/CHANGES) - [Commits](https://github.com/yaml/pyyaml/compare/5.3.1...5.4.1) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index a18bef34..f8d6fe29 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ art==5.1 -pyyaml==5.3.1 +pyyaml==5.4.1 codecov>=2.0.15 scipy>=1.2.0 networkx>=2.1 From 3db860e49c5d4b6cf97eb133e477d16d8c568f0a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:22:34 +0430 Subject: [PATCH 09/61] fix : _write_nodes_to_json function modified #82 --- pyrgg/graph_gen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 1af63b33..14512b9d 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -215,9 +215,8 @@ def _write_nodes_to_json(buf, edge_dic): nodes, '\t\t\t{\n\t\t\t\t', '"id": ', - '"', str(key), - '"\n\t\t\t}' + '\n\t\t\t}' ]) buf.write(nodes) From 648b9999b658d926e65817e9b81105461aabff9e Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:23:27 +0430 Subject: [PATCH 10/61] fix : _write_edges_to_json function modified #82 --- pyrgg/graph_gen.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 14512b9d..71e6f7ea 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -247,17 +247,14 @@ def _write_edges_to_json(buf, edge_dic, weight_dic): edges = "".join([ edges, '\t\t\t{\n\t\t\t\t"source": ', - '"', str(key), - '",\n\t\t\t\t', + ',\n\t\t\t\t', '"target": ', - '"', str(value), - '",\n\t\t\t\t', + ',\n\t\t\t\t', '"weight": ', - '"', str(weight_dic[key][j]), - '"\n\t\t\t}' + '\n\t\t\t}' ]) buf.write(edges) From f2018d6a48ddc33446a7751ea50a28112d0a2260 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:28:46 +0430 Subject: [PATCH 11/61] fix : tests updated #82 --- test/graph_gen_test.py | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/test/graph_gen_test.py b/test/graph_gen_test.py index 35e1046b..9e9d8ebf 100644 --- a/test/graph_gen_test.py +++ b/test/graph_gen_test.py @@ -384,86 +384,86 @@ >>> file=open('testfile.json','r') >>> testfile_1=json.load(file) >>> testfile_1['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_1['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1['graph']['edges'][1]['weight'] -'148' +148 >>> json_to_yaml('testfile') >>> file=open('testfile.yaml','r') >>> testfile_1_yaml=yaml.load(file) >>> testfile_1_yaml['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1_yaml['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1_yaml['graph']['edges'][1]['weight'] -'148' +148 >>> json_to_pickle('testfile') >>> testfile_1_p=pickle.load( open( 'testfile.p', 'rb' ) ) >>> testfile_1_p['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1_p['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1_p['graph']['edges'][1]['weight'] -'148' +148 >>> random.seed(4) >>> json_maker('testfile2',0,50,30,0,4,True,True,True,False) 35 >>> file=open('testfile2.json','r') >>> testfile_2=json.load(file) >>> testfile_2['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_2['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2['graph']['edges'][1]['weight'] -'5' +5 >>> json_to_yaml('testfile2') >>> file=open('testfile2.yaml','r') >>> testfile_2_yaml=yaml.load(file) >>> testfile_2_yaml['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_2_yaml['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2_yaml['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2_yaml['graph']['edges'][1]['weight'] -'5' +5 >>> json_to_pickle('testfile2') >>> testfile_2_p=pickle.load( open( 'testfile2.p', 'rb' ) ) >>> testfile_2_p['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2_p['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2_p['graph']['edges'][1]['weight'] -'5' +5 >>> random.seed(20) >>> json_maker('testfile3',10,30,100,0,4,False,True,True,False) 137 >>> file=open('testfile3.json','r') >>> testfile_3=json.load(file) >>> testfile_3['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_3['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3['graph']['edges'][1]['weight'] -'15' +15 >>> json_to_yaml('testfile3') >>> file=open('testfile3.yaml','r') >>> testfile_3_yaml=yaml.load(file) >>> testfile_3_yaml['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_3_yaml['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3_yaml['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3_yaml['graph']['edges'][1]['weight'] -'15' +15 >>> json_to_yaml('testfile24') [Error] Bad Input File! >>> json_to_pickle('testfile24') @@ -475,11 +475,11 @@ >>> json_to_pickle('testfile3') >>> testfile_3_p=pickle.load( open( 'testfile3.p', 'rb' ) ) >>> testfile_3_p['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3_p['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3_p['graph']['edges'][1]['weight'] -'15' +15 >>> random.seed(20) >>> json_maker('testfile3',10,30,100,0,4,False,False,True,True) 131 From 02b9fcaa47344107bfce729ffc75123ece3fea71 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:31:24 +0430 Subject: [PATCH 12/61] fix : tests updated #82 --- pyrgg/test.py | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/pyrgg/test.py b/pyrgg/test.py index 325561f2..b4e7a0b9 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -345,86 +345,86 @@ >>> file=open('testfile.json','r') >>> testfile_1=json.load(file) >>> testfile_1['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_1['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1['graph']['edges'][1]['weight'] -'148' +148 >>> json_to_yaml('testfile') >>> file=open('testfile.yaml','r') >>> testfile_1_yaml=yaml.load(file) >>> testfile_1_yaml['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1_yaml['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1_yaml['graph']['edges'][1]['weight'] -'148' +148 >>> json_to_pickle('testfile') >>> testfile_1_p=pickle.load( open( 'testfile.p', 'rb' ) ) >>> testfile_1_p['graph']['edges'][1]['source'] -'5' +5 >>> testfile_1_p['graph']['edges'][1]['target'] -'6' +6 >>> testfile_1_p['graph']['edges'][1]['weight'] -'148' +148 >>> random.seed(4) >>> json_maker('testfile2',0,50,30,0,4,True,True,True,False) 35 >>> file=open('testfile2.json','r') >>> testfile_2=json.load(file) >>> testfile_2['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_2['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2['graph']['edges'][1]['weight'] -'5' +5 >>> json_to_yaml('testfile2') >>> file=open('testfile2.yaml','r') >>> testfile_2_yaml=yaml.load(file) >>> testfile_2_yaml['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_2_yaml['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2_yaml['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2_yaml['graph']['edges'][1]['weight'] -'5' +5 >>> json_to_pickle('testfile2') >>> testfile_2_p=pickle.load( open( 'testfile2.p', 'rb' ) ) >>> testfile_2_p['graph']['edges'][1]['source'] -'2' +2 >>> testfile_2_p['graph']['edges'][1]['target'] -'18' +18 >>> testfile_2_p['graph']['edges'][1]['weight'] -'5' +5 >>> random.seed(20) >>> json_maker('testfile3',10,30,100,0,4,False,True,True,False) 137 >>> file=open('testfile3.json','r') >>> testfile_3=json.load(file) >>> testfile_3['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_3['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3['graph']['edges'][1]['weight'] -'15' +15 >>> json_to_yaml('testfile3') >>> file=open('testfile3.yaml','r') >>> testfile_3_yaml=yaml.load(file) >>> testfile_3_yaml['graph']['nodes'][1] -{'id': '2'} +{'id': 2} >>> testfile_3_yaml['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3_yaml['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3_yaml['graph']['edges'][1]['weight'] -'15' +15 >>> json_to_yaml('testfile24') [Error] Bad Input File! >>> json_to_pickle('testfile24') @@ -436,11 +436,11 @@ >>> json_to_pickle('testfile3') >>> testfile_3_p=pickle.load( open( 'testfile3.p', 'rb' ) ) >>> testfile_3_p['graph']['edges'][1]['source'] -'3' +3 >>> testfile_3_p['graph']['edges'][1]['target'] -'76' +76 >>> testfile_3_p['graph']['edges'][1]['weight'] -'15' +15 >>> random.seed(2) >>> csv_maker('testfile', 0, 200, 10, 0, 2, True,True,True,False) 7 From 2b4c15cf97813982be670206ad1eaf2a892b6f86 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:33:02 +0430 Subject: [PATCH 13/61] doc : README formats section updated #82 --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index abd10903..ab1bb975 100644 --- a/README.md +++ b/README.md @@ -256,21 +256,21 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). "graph": { "nodes":[ { - "id": "1" + "id": 1 }, . . . { - "id": "n" + "id": n } ], "edges":[ { - "source": "head_1", - "target": "tail_1", - "weight": "weight_1" + "source": head_1, + "target": tail_1, + "weight": weight_1 }, . @@ -278,9 +278,9 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). . { - "source": "head_n", - "target": "tail_n", - "weight": "weight_n" + "source": head_n, + "target": tail_n, + "weight": weight_n }, ] } @@ -290,26 +290,26 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). ``` graph: edges: - - source: "head_1" - target: "tail_1" - weight: "weight_1" + - source: head_1 + target: tail_1 + weight: weight_1 . . . - - source: "head_n" - target: "tail_n" - weight: "weight_n" + - source: head_n + target: tail_n + weight: weight_n nodes: - - id: '1' + - id: 1 . . . - - id: 'n' + - id: n ``` - [Weighted Edge List(.wel)](http://www.cs.cmu.edu/~pbbs/benchmarks/graphIO.html) From 136243c646638a2f87ca81e61e5d5f987a19ac38 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:38:46 +0430 Subject: [PATCH 14/61] doc : CHANGELOG updated #82 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d41fa99a..f15c3f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `requirements-splitter.py` ### Changed - Test system modified +- JSON format value changed to number +- YAML format value changed to number +- Pickle format value changed to number ## [1.0] - 2021-01-11 ### Added - Number of files option From d5696b59f166bb625c82679672a5c05d28a771ee Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 25 Mar 2021 00:40:44 +0430 Subject: [PATCH 15/61] doc : CHANGELOG updated #82 --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f15c3f3f..887abd31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `requirements-splitter.py` ### Changed - Test system modified -- JSON format value changed to number -- YAML format value changed to number -- Pickle format value changed to number +- JSON format value changed from `string` to `number` +- YAML format value changed from `string` to `number` +- Pickle format value changed from `string` to `number` ## [1.0] - 2021-01-11 ### Added - Number of files option From 7eb82a58de09b07155441252264544c0e556dc3e Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 30 Mar 2021 18:11:55 +0430 Subject: [PATCH 16/61] fix : is_weighted function added #84 --- pyrgg/functions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 73cb9603..b5d40ce0 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -23,6 +23,20 @@ random_system = random +def is_weighted(max_weight,min_weight): + """ + Check the graph is weighted or not. + + :param max_weight: maximum weight + :type max_weight: int + :param min_weight: minimum weight + :type min_weight: int + :return: result as bool + """ + if max_weight == min_weight and min_weight == 1: + return False + return True + def get_precision(input_number): """ Return precision of input number. From 685787e441cc6c1d9f58e2e2672dd215d488799d Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 30 Mar 2021 18:14:54 +0430 Subject: [PATCH 17/61] fix : minor edit in logger function #84 --- pyrgg/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index b5d40ce0..434214b6 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -219,7 +219,7 @@ def logger( "Signed : " + str(bool(signed)) + "\n" + "Multigraph : " + str(bool(multigraph)) + "\n" + "Self Loop : " + str(bool(self_loop)) + "\n" + - "Weighted : " + str(bool(weighted)) + "\n" + + "Weighted : " + str(bool(is_weighted(max_weight,min_weight))) + "\n" + "Max Weight : " + str(max_weight) + "\n" + "Min Weight : " + str(min_weight) + "\n" + "Elapsed Time : " + elapsed_time + "\n" + From 1ef14a0226677a40abca62bf40cf6182f0121897 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 01:13:06 +0430 Subject: [PATCH 18/61] fix : is_weighted function updated #84 --- pyrgg/functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 434214b6..805c3e91 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -23,7 +23,7 @@ random_system = random -def is_weighted(max_weight,min_weight): +def is_weighted(max_weight,min_weight,signed): """ Check the graph is weighted or not. @@ -31,9 +31,11 @@ def is_weighted(max_weight,min_weight): :type max_weight: int :param min_weight: minimum weight :type min_weight: int + :param signed: weight sign flag + :type signed: bool :return: result as bool """ - if max_weight == min_weight and min_weight == 1: + if max_weight == min_weight and min_weight == 1 and not signed: return False return True From 0b30bb2fc7a21c87898a3572beef181c61ebc501 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 01:17:29 +0430 Subject: [PATCH 19/61] fix : logger function updated #84 --- pyrgg/__main__.py | 1 - pyrgg/functions.py | 5 +---- pyrgg/test.py | 4 ++-- test/functions_test.py | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pyrgg/__main__.py b/pyrgg/__main__.py index 31e53e31..72334acb 100644 --- a/pyrgg/__main__.py +++ b/pyrgg/__main__.py @@ -80,7 +80,6 @@ def gen_graph(input_dict, file_name): sign, multigraph, self_loop, - weight, max_weight, min_weight, elapsed_time_format) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 805c3e91..4b710ff5 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -174,7 +174,6 @@ def logger( signed, multigraph, self_loop, - weighted, max_weight, min_weight, elapsed_time): @@ -199,8 +198,6 @@ def logger( :type multigraph: int :param self_loop: self loop flag :type self_loop: int - :param weighted: weighted flag - :type weighted: int :param max_weight: maximum weight :type max_weight: int :param min_weight: minimum weight @@ -221,7 +218,7 @@ def logger( "Signed : " + str(bool(signed)) + "\n" + "Multigraph : " + str(bool(multigraph)) + "\n" + "Self Loop : " + str(bool(self_loop)) + "\n" + - "Weighted : " + str(bool(is_weighted(max_weight,min_weight))) + "\n" + + "Weighted : " + str(is_weighted(max_weight,min_weight,bool(signed))) + "\n" + "Max Weight : " + str(max_weight) + "\n" + "Min Weight : " + str(min_weight) + "\n" + "Elapsed Time : " + elapsed_time + "\n" + diff --git a/pyrgg/test.py b/pyrgg/test.py index b4e7a0b9..1001c9c9 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -31,7 +31,7 @@ True >>> is_float(None) False ->>> logger(2,2,2,2,2,2,2,2,2,2,2,2,2) +>>> logger(2,2,2,2,2,2,2,2,2,2,2,2) [Error] Logger Failed! >>> result = input_filter({"file_name": "test","vertices": 5,"max_weight": 1000,"min_weight":455,"min_edge": -45,"max_edge": -11,"sign": False,"output_format": 19, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2}) >>> result == {'output_format': 1, 'min_weight': 455, 'min_edge': 5, 'max_edge': 5, 'file_name': 'test', 'vertices': 5, 'max_weight': 1000, 'sign': False, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2} @@ -45,7 +45,7 @@ >>> result = input_filter({"file_name": "test2","vertices": 23,"max_weight": 2,"min_weight": 80,"min_edge": 23,"max_edge": 1,"sign": True,"output_format": 1, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":100}) >>> result == {'min_weight': 2, 'vertices': 23, 'file_name': 'test2', 'max_edge': 23, 'min_edge': 1, 'max_weight': 80, 'output_format': 1, 'sign': True, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":100} True ->>> logger('test',100,50,1000,10,1,0,0,1,1,20,1,'2min') +>>> logger('test',100,50,1000,10,1,0,0,1,20,1,'2min') >>> file=open('logfile.log','r') >>> print("\n".join(file.read().splitlines()[1:-1])) Filename : test diff --git a/test/functions_test.py b/test/functions_test.py index 77391ff5..5e5cca08 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -2,7 +2,7 @@ """ >>> from pyrgg.functions import * >>> import random ->>> logger(2,2,2,2,2,2,2,2,2,2,2,2,2) +>>> logger(2,2,2,2,2,2,2,2,2,2,2,2) [Error] Logger Failed! >>> description_print() Webpage : https://www.pyrgg.ir @@ -37,7 +37,7 @@ >>> result = input_filter({"file_name": "test2","vertices": 23,"max_weight": 2,"min_weight": 80,"min_edge": 23,"max_edge": 1,"sign": True,"output_format": 1, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2}) >>> result == {'min_weight': 2, 'vertices': 23, 'file_name': 'test2', 'max_edge': 23, 'min_edge': 1, 'max_weight': 80, 'output_format': 1, 'sign': True, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2} True ->>> logger('test',100,50,1000,10,1,0,0,1,1,20,1,'2min') +>>> logger('test',100,50,1000,10,1,0,0,1,20,1,'2min') >>> file=open('logfile.log','r') >>> print("\\n".join(file.read().splitlines()[1:-1])) Filename : test From e6f19071116f6fa11fabb6db08daf09a11acaa22 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 13:22:52 +0430 Subject: [PATCH 20/61] feat : _write_properties_to_json function added #84 --- pyrgg/graph_gen.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 71e6f7ea..6c1ea821 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -166,6 +166,7 @@ def json_maker( ) with open(file_name + ".json", "w") as buf: + _write_properties_to_json(buf, min_weight, max_weight, sign, direct, self_loop, multigraph) _write_to_json( buf, edge_dic, @@ -185,12 +186,38 @@ def _write_to_json(buf, edge_dic, weight_dic): :type weight_dic: dict :return: None """ - buf.write('{\n\t"graph": {\n') + buf.write('\n\t"graph": {\n') _write_nodes_to_json(buf, edge_dic) buf.write("\n\t\t],\n") _write_edges_to_json(buf, edge_dic, weight_dic) buf.write("\n\t\t]\n\t}\n}") +def _write_properties_to_json(buf, min_weight, max_weight, sign, direct, self_loop, multigraph): + """ + Write properties to json buffer. + + :param buf: output file object + :type buf: file_object + :param min_weight: weight min range + :type min_weight: int + :param max_weight: weight max range + :type max_weight: int + :param sign: weight sign flag + :type sign: bool + :param direct: directed and undirected graph flag + :type direct: bool + :param self_loop: self loop flag + :type self_loop: bool + :param multigraph: multigraph flag + :type multigraph: bool + :return: None + """ + buf.write('{\n\t"properties": {\n') + buf.write('\t\t\t"directed": ' + str(direct).lower() + ",\n") + buf.write('\t\t\t"signed": ' + str(sign).lower() + ",\n") + buf.write('\t\t\t"multigraph": ' + str(multigraph).lower() + ",\n") + buf.write('\t\t\t"weighted": ' + str(is_weighted(max_weight,min_weight,sign)).lower() + ",\n") + buf.write('\t\t\t"self_loops": ' + str(self_loop).lower() + "\n\t},") def _write_nodes_to_json(buf, edge_dic): """Write nodes to json. From 26b1971141443b7d19dbf81ee19135ca5fbfc742 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:02:28 +0430 Subject: [PATCH 21/61] fix : autopep8 #84 --- pyrgg/functions.py | 58 ++++++++++++++++++++++++++++++++++------------ pyrgg/graph_gen.py | 23 +++++++++++++++--- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 4b710ff5..0450766b 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -23,7 +23,7 @@ random_system = random -def is_weighted(max_weight,min_weight,signed): +def is_weighted(max_weight, min_weight, signed): """ Check the graph is weighted or not. @@ -39,6 +39,7 @@ def is_weighted(max_weight,min_weight,signed): return False return True + def get_precision(input_number): """ Return precision of input number. @@ -208,20 +209,47 @@ def logger( """ try: with open("logfile.log", "a") as file: - file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + "\n" + - "Filename : " + file_name + "\n" + - "Vertices : " + str(vertices_number) + "\n" + - "Total Edges : " + str(edge_number) + "\n" + - "Max Edge : " + str(max_edge) + "\n" + - "Min Edge : " + str(min_edge) + "\n" + - "Directed : " + str(bool(directed)) + "\n" + - "Signed : " + str(bool(signed)) + "\n" + - "Multigraph : " + str(bool(multigraph)) + "\n" + - "Self Loop : " + str(bool(self_loop)) + "\n" + - "Weighted : " + str(is_weighted(max_weight,min_weight,bool(signed))) + "\n" + - "Max Weight : " + str(max_weight) + "\n" + - "Min Weight : " + str(min_weight) + "\n" + - "Elapsed Time : " + elapsed_time + "\n" + + file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + + "\n" + + "Filename : " + + file_name + + "\n" + + "Vertices : " + + str(vertices_number) + + "\n" + + "Total Edges : " + + str(edge_number) + + "\n" + + "Max Edge : " + + str(max_edge) + + "\n" + + "Min Edge : " + + str(min_edge) + + "\n" + + "Directed : " + + str(bool(directed)) + + "\n" + + "Signed : " + + str(bool(signed)) + + "\n" + + "Multigraph : " + + str(bool(multigraph)) + + "\n" + + "Self Loop : " + + str(bool(self_loop)) + + "\n" + + "Weighted : " + + str(is_weighted(max_weight, min_weight, bool(signed))) + + "\n" + + "Max Weight : " + + str(max_weight) + + "\n" + + "Min Weight : " + + str(min_weight) + + "\n" + + "Elapsed Time : " + + elapsed_time + + "\n" + "-------------------------------\n") except Exception: print(PYRGG_LOGGER_ERROR_MESSAGE) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 6c1ea821..431519b7 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -166,7 +166,14 @@ def json_maker( ) with open(file_name + ".json", "w") as buf: - _write_properties_to_json(buf, min_weight, max_weight, sign, direct, self_loop, multigraph) + _write_properties_to_json( + buf, + min_weight, + max_weight, + sign, + direct, + self_loop, + multigraph) _write_to_json( buf, edge_dic, @@ -192,7 +199,15 @@ def _write_to_json(buf, edge_dic, weight_dic): _write_edges_to_json(buf, edge_dic, weight_dic) buf.write("\n\t\t]\n\t}\n}") -def _write_properties_to_json(buf, min_weight, max_weight, sign, direct, self_loop, multigraph): + +def _write_properties_to_json( + buf, + min_weight, + max_weight, + sign, + direct, + self_loop, + multigraph): """ Write properties to json buffer. @@ -216,9 +231,11 @@ def _write_properties_to_json(buf, min_weight, max_weight, sign, direct, self_lo buf.write('\t\t\t"directed": ' + str(direct).lower() + ",\n") buf.write('\t\t\t"signed": ' + str(sign).lower() + ",\n") buf.write('\t\t\t"multigraph": ' + str(multigraph).lower() + ",\n") - buf.write('\t\t\t"weighted": ' + str(is_weighted(max_weight,min_weight,sign)).lower() + ",\n") + buf.write('\t\t\t"weighted": ' + + str(is_weighted(max_weight, min_weight, sign)).lower() + ",\n") buf.write('\t\t\t"self_loops": ' + str(self_loop).lower() + "\n\t},") + def _write_nodes_to_json(buf, edge_dic): """Write nodes to json. From 1757d5da7db7217bac186098ac6319e308ed8902 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:07:03 +0430 Subject: [PATCH 22/61] fix : _write_to_json function renamed to _write_data_to_json #84 --- pyrgg/graph_gen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 431519b7..491e36bf 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -174,7 +174,7 @@ def json_maker( direct, self_loop, multigraph) - _write_to_json( + _write_data_to_json( buf, edge_dic, weight_dic, @@ -182,7 +182,7 @@ def json_maker( return edge_number -def _write_to_json(buf, edge_dic, weight_dic): +def _write_data_to_json(buf, edge_dic, weight_dic): """Write data to json buffer. :param buf: output file object From ac0ef089cf6de6c8430c05d0cce832e99ea33c6f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:09:57 +0430 Subject: [PATCH 23/61] fix : minor edit in json format tabs #84 --- pyrgg/graph_gen.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 491e36bf..570891ef 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -228,12 +228,12 @@ def _write_properties_to_json( :return: None """ buf.write('{\n\t"properties": {\n') - buf.write('\t\t\t"directed": ' + str(direct).lower() + ",\n") - buf.write('\t\t\t"signed": ' + str(sign).lower() + ",\n") - buf.write('\t\t\t"multigraph": ' + str(multigraph).lower() + ",\n") - buf.write('\t\t\t"weighted": ' + + buf.write('\t\t"directed": ' + str(direct).lower() + ",\n") + buf.write('\t\t"signed": ' + str(sign).lower() + ",\n") + buf.write('\t\t"multigraph": ' + str(multigraph).lower() + ",\n") + buf.write('\t\t"weighted": ' + str(is_weighted(max_weight, min_weight, sign)).lower() + ",\n") - buf.write('\t\t\t"self_loops": ' + str(self_loop).lower() + "\n\t},") + buf.write('\t\t"self_loops": ' + str(self_loop).lower() + "\n\t},") def _write_nodes_to_json(buf, edge_dic): @@ -246,7 +246,7 @@ def _write_nodes_to_json(buf, edge_dic): :return: None """ first_line = True - nodes = '\t\t\t"nodes":[\n' + nodes = '\t\t"nodes":[\n' buf.write(nodes) for key in edge_dic: @@ -257,10 +257,10 @@ def _write_nodes_to_json(buf, edge_dic): nodes += ",\n" nodes = "".join([ nodes, - '\t\t\t{\n\t\t\t\t', + '\t\t{\n\t\t\t', '"id": ', str(key), - '\n\t\t\t}' + '\n\t\t}' ]) buf.write(nodes) @@ -276,7 +276,7 @@ def _write_edges_to_json(buf, edge_dic, weight_dic): :type weight_dic: dict :return: None """ - edges = '\t\t\t"edges":[\n' + edges = '\t\t"edges":[\n' first_line = True buf.write(edges) @@ -290,15 +290,15 @@ def _write_edges_to_json(buf, edge_dic, weight_dic): edges += ",\n" edges = "".join([ edges, - '\t\t\t{\n\t\t\t\t"source": ', + '\t\t{\n\t\t\t"source": ', str(key), - ',\n\t\t\t\t', + ',\n\t\t\t', '"target": ', str(value), - ',\n\t\t\t\t', + ',\n\t\t\t', '"weight": ', str(weight_dic[key][j]), - '\n\t\t\t}' + '\n\t\t}' ]) buf.write(edges) From ad3715e0666fef74605d70f0e5143496fdcd50c0 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:22:47 +0430 Subject: [PATCH 24/61] fix : typo in _write_properties_to_json function fixed #84 --- pyrgg/graph_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrgg/graph_gen.py b/pyrgg/graph_gen.py index 570891ef..b79bf835 100644 --- a/pyrgg/graph_gen.py +++ b/pyrgg/graph_gen.py @@ -233,7 +233,7 @@ def _write_properties_to_json( buf.write('\t\t"multigraph": ' + str(multigraph).lower() + ",\n") buf.write('\t\t"weighted": ' + str(is_weighted(max_weight, min_weight, sign)).lower() + ",\n") - buf.write('\t\t"self_loops": ' + str(self_loop).lower() + "\n\t},") + buf.write('\t\t"self_loop": ' + str(self_loop).lower() + "\n\t},") def _write_nodes_to_json(buf, edge_dic): From 12ddd40ce30f9fbe27894215e1b03f3c9ed470d6 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:37:57 +0430 Subject: [PATCH 25/61] fix : tests upedated #84 --- test/graph_gen_test.py | 116 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/test/graph_gen_test.py b/test/graph_gen_test.py index 9e9d8ebf..ba0f52c7 100644 --- a/test/graph_gen_test.py +++ b/test/graph_gen_test.py @@ -391,6 +391,16 @@ 6 >>> testfile_1['graph']['edges'][1]['weight'] 148 +>>> testfile_1['properties']['signed'] +True +>>> testfile_1['properties']['directed'] +True +>>> testfile_1['properties']['self_loop'] +True +>>> testfile_1['properties']['multigraph'] +False +>>> testfile_1['properties']['weighted'] +True >>> json_to_yaml('testfile') >>> file=open('testfile.yaml','r') >>> testfile_1_yaml=yaml.load(file) @@ -400,6 +410,16 @@ 6 >>> testfile_1_yaml['graph']['edges'][1]['weight'] 148 +>>> testfile_1_yaml['properties']['signed'] +True +>>> testfile_1_yaml['properties']['directed'] +True +>>> testfile_1_yaml['properties']['self_loop'] +True +>>> testfile_1_yaml['properties']['multigraph'] +False +>>> testfile_1_yaml['properties']['weighted'] +True >>> json_to_pickle('testfile') >>> testfile_1_p=pickle.load( open( 'testfile.p', 'rb' ) ) >>> testfile_1_p['graph']['edges'][1]['source'] @@ -408,6 +428,16 @@ 6 >>> testfile_1_p['graph']['edges'][1]['weight'] 148 +>>> testfile_1_p['properties']['signed'] +True +>>> testfile_1_p['properties']['directed'] +True +>>> testfile_1_p['properties']['self_loop'] +True +>>> testfile_1_p['properties']['multigraph'] +False +>>> testfile_1_p['properties']['weighted'] +True >>> random.seed(4) >>> json_maker('testfile2',0,50,30,0,4,True,True,True,False) 35 @@ -421,6 +451,16 @@ 18 >>> testfile_2['graph']['edges'][1]['weight'] 5 +>>> testfile_2['properties']['signed'] +True +>>> testfile_2['properties']['directed'] +True +>>> testfile_2['properties']['self_loop'] +True +>>> testfile_2['properties']['multigraph'] +False +>>> testfile_2['properties']['weighted'] +True >>> json_to_yaml('testfile2') >>> file=open('testfile2.yaml','r') >>> testfile_2_yaml=yaml.load(file) @@ -432,6 +472,16 @@ 18 >>> testfile_2_yaml['graph']['edges'][1]['weight'] 5 +>>> testfile_2_yaml['properties']['signed'] +True +>>> testfile_2_yaml['properties']['directed'] +True +>>> testfile_2_yaml['properties']['self_loop'] +True +>>> testfile_2_yaml['properties']['multigraph'] +False +>>> testfile_2_yaml['properties']['weighted'] +True >>> json_to_pickle('testfile2') >>> testfile_2_p=pickle.load( open( 'testfile2.p', 'rb' ) ) >>> testfile_2_p['graph']['edges'][1]['source'] @@ -440,6 +490,16 @@ 18 >>> testfile_2_p['graph']['edges'][1]['weight'] 5 +>>> testfile_2_p['properties']['signed'] +True +>>> testfile_2_p['properties']['directed'] +True +>>> testfile_2_p['properties']['self_loop'] +True +>>> testfile_2_p['properties']['multigraph'] +False +>>> testfile_2_p['properties']['weighted'] +True >>> random.seed(20) >>> json_maker('testfile3',10,30,100,0,4,False,True,True,False) 137 @@ -453,6 +513,16 @@ 76 >>> testfile_3['graph']['edges'][1]['weight'] 15 +>>> testfile_3['properties']['signed'] +False +>>> testfile_3['properties']['directed'] +True +>>> testfile_3['properties']['self_loop'] +True +>>> testfile_3['properties']['multigraph'] +False +>>> testfile_3['properties']['weighted'] +True >>> json_to_yaml('testfile3') >>> file=open('testfile3.yaml','r') >>> testfile_3_yaml=yaml.load(file) @@ -464,6 +534,16 @@ 76 >>> testfile_3_yaml['graph']['edges'][1]['weight'] 15 +>>> testfile_3_yaml['properties']['signed'] +False +>>> testfile_3_yaml['properties']['directed'] +True +>>> testfile_3_yaml['properties']['self_loop'] +True +>>> testfile_3_yaml['properties']['multigraph'] +False +>>> testfile_3_yaml['properties']['weighted'] +True >>> json_to_yaml('testfile24') [Error] Bad Input File! >>> json_to_pickle('testfile24') @@ -480,9 +560,45 @@ 76 >>> testfile_3_p['graph']['edges'][1]['weight'] 15 +>>> testfile_3_p['properties']['signed'] +False +>>> testfile_3_p['properties']['directed'] +True +>>> testfile_3_p['properties']['self_loop'] +True +>>> testfile_3_p['properties']['multigraph'] +False +>>> testfile_3_p['properties']['weighted'] +True >>> random.seed(20) >>> json_maker('testfile3',10,30,100,0,4,False,False,True,True) 131 +>>> file=open('testfile3.json','r') +>>> testfile_3=json.load(file) +>>> testfile_3['properties']['signed'] +False +>>> testfile_3['properties']['directed'] +False +>>> testfile_3['properties']['self_loop'] +True +>>> testfile_3['properties']['multigraph'] +True +>>> testfile_3['properties']['weighted'] +True +>>> random.seed(21) +>>> json_maker('testfile3',1,1,100,0,4,False,False,True,True) +136 +>>> file=open('testfile3.json','r') +>>> testfile_3=json.load(file) +>>> testfile_3['properties']['weighted'] +False +>>> random.seed(21) +>>> json_maker('testfile3',1,1,100,0,4,True,False,True,True) +158 +>>> file=open('testfile3.json','r') +>>> testfile_3=json.load(file) +>>> testfile_3['properties']['weighted'] +True >>> random.seed(2) >>> csv_maker('testfile', 0, 200, 10, 0, 2, True,True,True,False) 7 From 7247ddd8db0ebd29fb03bbc3b3defea060207e34 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:41:12 +0430 Subject: [PATCH 26/61] fix : tests upedated #84 --- test/functions_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/functions_test.py b/test/functions_test.py index 5e5cca08..c0e0c803 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -69,6 +69,12 @@ ValueError: could not convert string to float: 'sadasdasd' >>> line(12,"*") ************ +>>> is_weighted(20,20,False) +True +>>> is_weighted(1,1,False) +False +>>> is_weighted(1,1,True) +True >>> get_precision(2) 0 >>> get_precision(2.2) From f8c13e056a3f8dc0eb75d40bcfd7be28e0bd258d Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:48:32 +0430 Subject: [PATCH 27/61] fix : is_weighted function modified #84 --- pyrgg/functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 0450766b..d113e12f 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -35,6 +35,8 @@ def is_weighted(max_weight, min_weight, signed): :type signed: bool :return: result as bool """ + if max_weight == min_weight and min_weight == 0: + return False if max_weight == min_weight and min_weight == 1 and not signed: return False return True From 7e8153bc8f2068bcfa16ece9006a4319e7309607 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:49:34 +0430 Subject: [PATCH 28/61] fix : tests updated #84 --- test/functions_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/functions_test.py b/test/functions_test.py index c0e0c803..778abe62 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -69,6 +69,10 @@ ValueError: could not convert string to float: 'sadasdasd' >>> line(12,"*") ************ +>>> is_weighted(0,0,False) +False +>>> is_weighted(0,0,True) +False >>> is_weighted(20,20,False) True >>> is_weighted(1,1,False) From 8eb9e1d0696d23b5af0a51dee3cc245ab12016c9 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:53:35 +0430 Subject: [PATCH 29/61] doc : CHANGELOG updated #84 --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 887abd31..a20270af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - `requirements-splitter.py` +- `is_weighted` function +- `_write_properties_to_json` function ### Changed - Test system modified -- JSON format value changed from `string` to `number` -- YAML format value changed from `string` to `number` -- Pickle format value changed from `string` to `number` +- JSON, YAML and Pickle formats value changed from `string` to `number` +- `properties` section added to JSON, YAML and Pickle formats +- `_write_to_json` function renamed to `_write_data_to_json` ## [1.0] - 2021-01-11 ### Added - Number of files option From 5c848d891583774f25cda9b9a7cab236eaa278e7 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 16:57:54 +0430 Subject: [PATCH 30/61] doc : README JSON section updated #84 --- README.md | 67 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index ab1bb975..3ad48621 100644 --- a/README.md +++ b/README.md @@ -252,39 +252,46 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). - [JSON(.json)](https://en.wikipedia.org/wiki/JSON) ``` - { + { + "properties": { + "directed": true, + "signed": true, + "multigraph": true, + "weighted": true, + "self_loop": true + }, "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 - }, - ] + "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)](https://en.wikipedia.org/wiki/YAML) ``` From eacf8229eb82edcb175f3ddc020e6de93f6e8db3 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Mar 2021 17:00:49 +0430 Subject: [PATCH 31/61] doc : README YAML section updated #84 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3ad48621..27aedb49 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,12 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). . - id: n + properties: + directed: true + multigraph: true + self_loop: true + signed: true + weighted: true ``` - [Weighted Edge List(.wel)](http://www.cs.cmu.edu/~pbbs/benchmarks/graphIO.html) From 53c67aaddd6b240ae730c7e4040936d6e9c00d7a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 01:28:22 +0430 Subject: [PATCH 32/61] doc : minor edit in YAML section in README #84 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27aedb49..6156fa90 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,7 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). . . . + { "id": n } @@ -288,7 +289,7 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). "source": head_n, "target": tail_n, "weight": weight_n - }, + } ] } } From 5361442814c66ed7fadf67aa7d797894f04112d8 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 15:12:39 +0430 Subject: [PATCH 33/61] fix : logger function modified --- pyrgg/functions.py | 46 ++++------------------------------------------ pyrgg/params.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 42 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index d113e12f..46ba4b4e 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -16,6 +16,7 @@ PYRGG_FILE_ERROR_MESSAGE, PYRGG_INPUT_ERROR_MESSAGE, PYRGG_LOGGER_ERROR_MESSAGE, + PYRGG_LOGGER_TEMPLATE, SUFFIX_MENU, ) @@ -211,48 +212,9 @@ def logger( """ try: with open("logfile.log", "a") as file: - file.write(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + - "\n" + - "Filename : " + - file_name + - "\n" + - "Vertices : " + - str(vertices_number) + - "\n" + - "Total Edges : " + - str(edge_number) + - "\n" + - "Max Edge : " + - str(max_edge) + - "\n" + - "Min Edge : " + - str(min_edge) + - "\n" + - "Directed : " + - str(bool(directed)) + - "\n" + - "Signed : " + - str(bool(signed)) + - "\n" + - "Multigraph : " + - str(bool(multigraph)) + - "\n" + - "Self Loop : " + - str(bool(self_loop)) + - "\n" + - "Weighted : " + - str(is_weighted(max_weight, min_weight, bool(signed))) + - "\n" + - "Max Weight : " + - str(max_weight) + - "\n" + - "Min Weight : " + - str(min_weight) + - "\n" + - "Elapsed Time : " + - elapsed_time + - "\n" + - "-------------------------------\n") + file.write(PYRGG_LOGGER_TEMPLATE.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),file_name,str(vertices_number),str(edge_number),str(max_edge), str(min_edge), + str(bool(directed)),str(bool(signed)),str(bool(multigraph)),str(bool(self_loop)),str(is_weighted(max_weight, min_weight, bool(signed))), + str(max_weight),str(min_weight),elapsed_time)) except Exception: print(PYRGG_LOGGER_ERROR_MESSAGE) diff --git a/pyrgg/params.py b/pyrgg/params.py index 85221822..b2c194a6 100644 --- a/pyrgg/params.py +++ b/pyrgg/params.py @@ -92,6 +92,24 @@ PYRGG_LOGGER_ERROR_MESSAGE = "[Error] Logger Failed!" +PYRGG_LOGGER_TEMPLATE = """{0} +Filename : {1} +Vertices : {2} +Total Edges : {3} +Max Edge : {4} +Min Edge : {5} +Directed : {6} +Signed : {7} +Multigraph : {8} +Self Loop : {9} +Weighted : {10} +Max Weight : {11} +Min Weight : {12} +Elapsed Time : {13} +------------------------------- + +""" + DIMACS_FIX = dedent( """\ c FILE :{0}.gr From fce2f2aae46f96ac4e5cb50536528b32441df364 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 15:44:04 +0430 Subject: [PATCH 34/61] fix : tests updated --- pyrgg/test.py | 2 -- test/functions_test.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/pyrgg/test.py b/pyrgg/test.py index 1001c9c9..d626957e 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -31,8 +31,6 @@ True >>> is_float(None) False ->>> logger(2,2,2,2,2,2,2,2,2,2,2,2) -[Error] Logger Failed! >>> result = input_filter({"file_name": "test","vertices": 5,"max_weight": 1000,"min_weight":455,"min_edge": -45,"max_edge": -11,"sign": False,"output_format": 19, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2}) >>> result == {'output_format': 1, 'min_weight': 455, 'min_edge': 5, 'max_edge': 5, 'file_name': 'test', 'vertices': 5, 'max_weight': 1000, 'sign': False, "direct": False,"self_loop": True,"multigraph":False,"number_of_files":2} True diff --git a/test/functions_test.py b/test/functions_test.py index 778abe62..e12ab290 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -2,8 +2,6 @@ """ >>> from pyrgg.functions import * >>> import random ->>> logger(2,2,2,2,2,2,2,2,2,2,2,2) -[Error] Logger Failed! >>> description_print() Webpage : https://www.pyrgg.ir Repository : https://github.com/sepandhaghighi/pyrgg From fcdc1c11dad15e25a062baf9073e6c8caf7c8dac Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 15:44:31 +0430 Subject: [PATCH 35/61] fix : autopep8 --- pyrgg/functions.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 46ba4b4e..201cfbc6 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -212,9 +212,22 @@ def logger( """ try: with open("logfile.log", "a") as file: - file.write(PYRGG_LOGGER_TEMPLATE.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),file_name,str(vertices_number),str(edge_number),str(max_edge), str(min_edge), - str(bool(directed)),str(bool(signed)),str(bool(multigraph)),str(bool(self_loop)),str(is_weighted(max_weight, min_weight, bool(signed))), - str(max_weight),str(min_weight),elapsed_time)) + file.write(PYRGG_LOGGER_TEMPLATE.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), + file_name, + str(vertices_number), + str(edge_number), + str(max_edge), + str(min_edge), + str(bool(directed)), + str(bool(signed)), + str(bool(multigraph)), + str(bool(self_loop)), + str(is_weighted(max_weight, + min_weight, + bool(signed))), + str(max_weight), + str(min_weight), + elapsed_time)) except Exception: print(PYRGG_LOGGER_ERROR_MESSAGE) From 3ebc1bc66491ea6739eddcf5bbc3b83fae548074 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 15:50:42 +0430 Subject: [PATCH 36/61] fix : minor bug in PYRGG_LOGGER_TEMPLATE fixed --- pyrgg/params.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyrgg/params.py b/pyrgg/params.py index b2c194a6..665c5b65 100644 --- a/pyrgg/params.py +++ b/pyrgg/params.py @@ -107,7 +107,6 @@ Min Weight : {12} Elapsed Time : {13} ------------------------------- - """ DIMACS_FIX = dedent( From 4876f883ce58a786c5f095c9764f9d2caa45ba11 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 1 Apr 2021 15:57:38 +0430 Subject: [PATCH 37/61] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a20270af..e9a42b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - JSON, YAML and Pickle formats value changed from `string` to `number` - `properties` section added to JSON, YAML and Pickle formats - `_write_to_json` function renamed to `_write_data_to_json` +- `logger` function modified ## [1.0] - 2021-01-11 ### Added - Number of files option From 1004575f7274a1c4b0139e27b0213b3598abf015 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:02:04 +0430 Subject: [PATCH 38/61] fix : time_convert function updated --- pyrgg/functions.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 201cfbc6..881a3388 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -240,15 +240,20 @@ def time_convert(input_string): :type input_string: str :return: converted time as str """ - sec = float(input_string) - days, sec = divmod(sec, 24 * 3600) - hours, sec = divmod(sec, 3600) - minutes, sec = divmod(sec, 60) + postfix_dict = {"s":"second","d":"day","h":"hour","m":"minute"} + value_dict = {"s":0,"d":0,"h":0,"m":0} + value_dict["s"] = float(input_string) + value_dict["d"], value_dict["s"] = divmod(value_dict["s"], 24 * 3600) + value_dict["h"], value_dict["s"] = divmod(value_dict["s"], 3600) + value_dict["m"], value_dict["s"] = divmod(value_dict["s"], 60) + for i in postfix_dict.keys(): + if value_dict[i] != 1: + postfix_dict[i] += "s" return ", ".join([ - "{:02.0f} days".format(days), - "{:02.0f} hour".format(hours), - "{:02.0f} minutes".format(minutes), - "{:02.0f} seconds".format(sec), + "{:02.0f} {1}".format(value_dict["d"],postfix_dict["d"]), + "{:02.0f} {1}".format(value_dict["h"],postfix_dict["h"]), + "{:02.0f} {1}".format(value_dict["m"],postfix_dict["m"]), + "{:02.0f} {1}".format(value_dict["s"],postfix_dict["s"]), ]) From def7fd3376f8f722c9f57f9724f70dee341b6a95 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:04:42 +0430 Subject: [PATCH 39/61] fix : minor bug in time_convert function fixed --- pyrgg/functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 881a3388..5de4d71e 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -250,10 +250,10 @@ def time_convert(input_string): if value_dict[i] != 1: postfix_dict[i] += "s" return ", ".join([ - "{:02.0f} {1}".format(value_dict["d"],postfix_dict["d"]), - "{:02.0f} {1}".format(value_dict["h"],postfix_dict["h"]), - "{:02.0f} {1}".format(value_dict["m"],postfix_dict["m"]), - "{:02.0f} {1}".format(value_dict["s"],postfix_dict["s"]), + "{0:02.0f} {1}".format(value_dict["d"],postfix_dict["d"]), + "{0:02.0f} {1}".format(value_dict["h"],postfix_dict["h"]), + "{0:02.0f} {1}".format(value_dict["m"],postfix_dict["m"]), + "{0:02.0f} {1}".format(value_dict["s"],postfix_dict["s"]), ]) From ad662c59cee4e0cf2c16fe738c6e98f53136c130 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:05:41 +0430 Subject: [PATCH 40/61] fix : tests updated --- pyrgg/test.py | 4 ++-- test/functions_test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrgg/test.py b/pyrgg/test.py index d626957e..051a9fb2 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -66,9 +66,9 @@ >>> convert_bytes(80000) '78.1 KB' >>> time_convert('33') -'00 days, 00 hour, 00 minutes, 33 seconds' +'00 days, 00 hours, 00 minutes, 33 seconds' >>> time_convert('15000') -'00 days, 04 hour, 10 minutes, 00 seconds' +'00 days, 04 hours, 10 minutes, 00 seconds' >>> time_convert('sadasdasd') Traceback (most recent call last): ... diff --git a/test/functions_test.py b/test/functions_test.py index e12ab290..9b1ecfdc 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -58,9 +58,9 @@ >>> convert_bytes(80000) '78.1 KB' >>> time_convert('33') -'00 days, 00 hour, 00 minutes, 33 seconds' +'00 days, 00 hours, 00 minutes, 33 seconds' >>> time_convert('15000') -'00 days, 04 hour, 10 minutes, 00 seconds' +'00 days, 04 hours, 10 minutes, 00 seconds' >>> time_convert('sadasdasd') Traceback (most recent call last): ... From 0c8ad4b63c6989b07f7418cbc32dfa05d88b8020 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:08:32 +0430 Subject: [PATCH 41/61] fix : time_convert function updated --- pyrgg/__main__.py | 2 +- pyrgg/functions.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyrgg/__main__.py b/pyrgg/__main__.py index 72334acb..b61a816f 100644 --- a/pyrgg/__main__.py +++ b/pyrgg/__main__.py @@ -66,7 +66,7 @@ def gen_graph(input_dict, file_name): filesize(file_name + SUFFIX_MENU[output_format]) second_time = time.perf_counter() elapsed_time = second_time - first_time - elapsed_time_format = time_convert(str(elapsed_time)) + elapsed_time_format = time_convert(elapsed_time) print("Total Number of Edges : " + str(edge_number)) print("Graph Generated in " + elapsed_time_format) print("Where --> " + SOURCE_DIR) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 5de4d71e..d93e66c7 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -232,17 +232,17 @@ def logger( print(PYRGG_LOGGER_ERROR_MESSAGE) -def time_convert(input_string): +def time_convert(input_time): """ - Convert input_string from sec to DD,HH,MM,SS format. + Convert input_time from sec to DD,HH,MM,SS format. - :param input_string: input time string in sec - :type input_string: str + :param input_time: input time in sec + :type input_time: int :return: converted time as str """ postfix_dict = {"s":"second","d":"day","h":"hour","m":"minute"} value_dict = {"s":0,"d":0,"h":0,"m":0} - value_dict["s"] = float(input_string) + value_dict["s"] = input_time value_dict["d"], value_dict["s"] = divmod(value_dict["s"], 24 * 3600) value_dict["h"], value_dict["s"] = divmod(value_dict["s"], 3600) value_dict["m"], value_dict["s"] = divmod(value_dict["s"], 60) From c771782a7e6787a83976e54377be5de8aa3a69c9 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:11:13 +0430 Subject: [PATCH 42/61] fix : tests updated --- pyrgg/functions.py | 4 ++-- pyrgg/test.py | 4 ++-- test/functions_test.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index d93e66c7..62560dfd 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -237,12 +237,12 @@ def time_convert(input_time): Convert input_time from sec to DD,HH,MM,SS format. :param input_time: input time in sec - :type input_time: int + :type input_time: float :return: converted time as str """ postfix_dict = {"s":"second","d":"day","h":"hour","m":"minute"} value_dict = {"s":0,"d":0,"h":0,"m":0} - value_dict["s"] = input_time + value_dict["s"] = float(input_time) value_dict["d"], value_dict["s"] = divmod(value_dict["s"], 24 * 3600) value_dict["h"], value_dict["s"] = divmod(value_dict["s"], 3600) value_dict["m"], value_dict["s"] = divmod(value_dict["s"], 60) diff --git a/pyrgg/test.py b/pyrgg/test.py index 051a9fb2..a6973f87 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -65,9 +65,9 @@ '5.9 KB' >>> convert_bytes(80000) '78.1 KB' ->>> time_convert('33') +>>> time_convert(33) '00 days, 00 hours, 00 minutes, 33 seconds' ->>> time_convert('15000') +>>> time_convert(15000) '00 days, 04 hours, 10 minutes, 00 seconds' >>> time_convert('sadasdasd') Traceback (most recent call last): diff --git a/test/functions_test.py b/test/functions_test.py index 9b1ecfdc..cc68c24a 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -57,9 +57,9 @@ '5.9 KB' >>> convert_bytes(80000) '78.1 KB' ->>> time_convert('33') +>>> time_convert(33) '00 days, 00 hours, 00 minutes, 33 seconds' ->>> time_convert('15000') +>>> time_convert(15000) '00 days, 04 hours, 10 minutes, 00 seconds' >>> time_convert('sadasdasd') Traceback (most recent call last): From 7f3cdf153b377e118c7c9cc260d4c502661770b9 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:15:02 +0430 Subject: [PATCH 43/61] fix : tests updated --- test/functions_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/functions_test.py b/test/functions_test.py index cc68c24a..9695f718 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -61,6 +61,18 @@ '00 days, 00 hours, 00 minutes, 33 seconds' >>> time_convert(15000) '00 days, 04 hours, 10 minutes, 00 seconds' +>>> time_convert(1) +'00 days, 00 hours, 00 minutes, 01 second' +>>> time_convert(60) +'00 days, 00 hours, 01 minute, 00 seconds' +>>> time_convert(60*60) +'00 days, 01 hour, 00 minutes, 00 seconds' +>>> time_convert(60*60*24) +'01 day, 00 hours, 00 minutes, 00 seconds' +>>> time_convert(60*60*24 + 60*60 + 60 + 1) +'01 day, 01 hour, 01 minute, 01 second' +>>> time_convert(0) +'00 days, 00 hours, 00 minutes, 00 seconds' >>> time_convert('sadasdasd') Traceback (most recent call last): ... From 347bad7faa5e42852a430f7f0466601ad2dd0771 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:16:18 +0430 Subject: [PATCH 44/61] fix : autopep8 --- pyrgg/functions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 62560dfd..d6ebc21f 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -240,8 +240,8 @@ def time_convert(input_time): :type input_time: float :return: converted time as str """ - postfix_dict = {"s":"second","d":"day","h":"hour","m":"minute"} - value_dict = {"s":0,"d":0,"h":0,"m":0} + postfix_dict = {"s": "second", "d": "day", "h": "hour", "m": "minute"} + value_dict = {"s": 0, "d": 0, "h": 0, "m": 0} value_dict["s"] = float(input_time) value_dict["d"], value_dict["s"] = divmod(value_dict["s"], 24 * 3600) value_dict["h"], value_dict["s"] = divmod(value_dict["s"], 3600) @@ -250,10 +250,10 @@ def time_convert(input_time): if value_dict[i] != 1: postfix_dict[i] += "s" return ", ".join([ - "{0:02.0f} {1}".format(value_dict["d"],postfix_dict["d"]), - "{0:02.0f} {1}".format(value_dict["h"],postfix_dict["h"]), - "{0:02.0f} {1}".format(value_dict["m"],postfix_dict["m"]), - "{0:02.0f} {1}".format(value_dict["s"],postfix_dict["s"]), + "{0:02.0f} {1}".format(value_dict["d"], postfix_dict["d"]), + "{0:02.0f} {1}".format(value_dict["h"], postfix_dict["h"]), + "{0:02.0f} {1}".format(value_dict["m"], postfix_dict["m"]), + "{0:02.0f} {1}".format(value_dict["s"], postfix_dict["s"]), ]) From fb80bb57d5fbe71b91a3e463cfd2384dc9b5b8ae Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 3 Apr 2021 18:17:53 +0430 Subject: [PATCH 45/61] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a42b9d..91060610 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `properties` section added to JSON, YAML and Pickle formats - `_write_to_json` function renamed to `_write_data_to_json` - `logger` function modified +- `time_convert` function modified ## [1.0] - 2021-01-11 ### Added - Number of files option From 5a69fb098008f1640c371d0d8b95e0ab75ed6812 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:26:49 +0000 Subject: [PATCH 46/61] Upgrade to GitHub-native Dependabot --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..24e7372b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: +- package-ecosystem: pip + directory: "/" + schedule: + interval: weekly + time: "01:30" + open-pull-requests-limit: 10 + target-branch: dev From 90b7ab6bea0eddee6737cea72a898824bf43dc22 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 31 May 2021 10:58:04 +0430 Subject: [PATCH 47/61] doc : references section updated #96 --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6156fa90..5486fcd4 100644 --- a/README.md +++ b/README.md @@ -545,12 +545,24 @@ If you use pyrgg in your research, please cite the [JOSS paper](http://joss.theo ## References -
+
1- 9th DIMACS Implementation Challenge - Shortest Paths
+ +
2- Problem Based Benchmark Suite
+ +
3- MaximalClique - ASP Competition 2013
+ +
4- Pitas, Ioannis, ed. Graph-based social media analysis. Vol. 39. CRC Press, 2016.
-DIMACS +
5- Roughan, Matthew, and Jonathan Tuke. "The hitchhikers guide to sharing graph data." 2015 3rd International Conference on Future Internet of Things and Cloud. IEEE, 2015.
+
6- Borgatti, Stephen P., Martin G. Everett, and Linton C. Freeman. "Ucinet for Windows: Software for social network analysis." Harvard, MA: analytic technologies 6 (2002).
-
+
7- Matrix Market: File Formats
+ +
8- Social Network Visualizer
+ +
9- Adar, Eytan. "GUESS: a language and interface for graph exploration." Proceedings of the SIGCHI conference on Human Factors in computing systems. 2006.
+ ## Donate to our project From e7ee6b55181d4b0b06cb882330e1101cd0abdc79 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 31 May 2021 11:02:14 +0430 Subject: [PATCH 48/61] doc : references section updated #96 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5486fcd4..c14e43a3 100644 --- a/README.md +++ b/README.md @@ -562,6 +562,8 @@ If you use pyrgg in your research, please cite the [JOSS paper](http://joss.theo
8- Social Network Visualizer
9- Adar, Eytan. "GUESS: a language and interface for graph exploration." Proceedings of the SIGCHI conference on Human Factors in computing systems. 2006.
+ +
10- Skiena, Steven S. The algorithm design manual. Springer International Publishing, 2020.
## Donate to our project From 9d25d88069a5f5fcf3b4aa82c2ad2589cf4b1d9a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 31 May 2021 11:04:09 +0430 Subject: [PATCH 49/61] doc : CHANGELOG updated #96 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91060610..2a945113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `_write_to_json` function renamed to `_write_data_to_json` - `logger` function modified - `time_convert` function modified +- References updated ## [1.0] - 2021-01-11 ### Added - Number of files option From d2e0191ef1c925269e39f7d802e13a6ebc033263 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 31 May 2021 11:06:40 +0430 Subject: [PATCH 50/61] fix : CONTRIBUTING.md updated #96 --- .github/CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 07287caa..46907d41 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,8 +12,9 @@ Please consider the following : 4. Add standard `docstring` to your functions/methods 5. Add tests for your functions/methods (`doctest` testcases in `test` folder) 6. Pass all CI tests -7. Update `CHANGELOG.md` +7. Update `References` section in `README.md` (`MLA` format) +8. Update `CHANGELOG.md` - Describe changes under `[Unreleased]` section -8. Update `AUTHORS.md` +9. Update `AUTHORS.md` - Add your name under `# Other Contributors #` section -9. Submit a pull request into `dev` (please complete the pull request template) \ No newline at end of file +10. Submit a pull request into `dev` (please complete the pull request template) \ No newline at end of file From 44ed473792e2b903d364ef0bd8ecae6acf28c396 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 31 May 2021 11:22:22 +0430 Subject: [PATCH 51/61] doc : references section updated #96 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c14e43a3..106fe2ab 100644 --- a/README.md +++ b/README.md @@ -564,6 +564,10 @@ If you use pyrgg in your research, please cite the [JOSS paper](http://joss.theo
9- Adar, Eytan. "GUESS: a language and interface for graph exploration." Proceedings of the SIGCHI conference on Human Factors in computing systems. 2006.
10- Skiena, Steven S. The algorithm design manual. Springer International Publishing, 2020.
+ +
11- Chakrabarti, Deepayan, Yiping Zhan, and Christos Faloutsos. "R-MAT: A recursive model for graph mining." Proceedings of the 2004 SIAM International Conference on Data Mining. Society for Industrial and Applied Mathematics, 2004.
+ +
12- Zhong, Jianlong, and Bingsheng He. "An overview of medusa: simplified graph processing on gpus." ACM SIGPLAN Notices 47.8 (2012): 283-284.
## Donate to our project From 8d8e6570c27bab33e05de9c1ada6c531a85a1682 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 17:43:26 +0000 Subject: [PATCH 52/61] Bump art from 5.1 to 5.2 Bumps [art](https://github.com/sepandhaghighi/art) from 5.1 to 5.2. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v5.1...v5.2) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index f8d6fe29..9306081a 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -art==5.1 +art==5.2 pyyaml==5.4.1 codecov>=2.0.15 scipy>=1.2.0 From 5ecf92919a5b7705f69b29c6f59095be34c42a73 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:26:51 +0430 Subject: [PATCH 53/61] fix : minor edit in import section in functions.py #98 --- pyrgg/functions.py | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index d6ebc21f..271b7f26 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -7,18 +7,7 @@ import random import textwrap import yaml - -from pyrgg.params import ( - MENU_ITEMS1, - MENU_ITEMS2, - PYRGG_LINKS, - PYRGG_DESCRIPTION, - PYRGG_FILE_ERROR_MESSAGE, - PYRGG_INPUT_ERROR_MESSAGE, - PYRGG_LOGGER_ERROR_MESSAGE, - PYRGG_LOGGER_TEMPLATE, - SUFFIX_MENU, -) +import pyrgg.params # random_system=random.SystemRandom() random_system = random @@ -120,10 +109,10 @@ def description_print(): :return: None """ - print(PYRGG_LINKS) + print(pyrgg.params.PYRGG_LINKS) line(40) print("\n") - print(textwrap.fill(PYRGG_DESCRIPTION, width=100)) + print(textwrap.fill(pyrgg.params.PYRGG_DESCRIPTION, width=100)) print("\n") line(40) @@ -212,7 +201,7 @@ def logger( """ try: with open("logfile.log", "a") as file: - file.write(PYRGG_LOGGER_TEMPLATE.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), + file.write(pyrgg.params.PYRGG_LOGGER_TEMPLATE.format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), file_name, str(vertices_number), str(edge_number), @@ -229,7 +218,7 @@ def logger( str(min_weight), elapsed_time)) except Exception: - print(PYRGG_LOGGER_ERROR_MESSAGE) + print(pyrgg.params.PYRGG_LOGGER_ERROR_MESSAGE) def time_convert(input_time): @@ -285,7 +274,7 @@ def input_filter(input_dict): edge_upper_threshold -= 1 if filtered_dict["output_format"] not in list( - range(1, len(SUFFIX_MENU) + 1)): + range(1, len(pyrgg.params.SUFFIX_MENU) + 1)): filtered_dict["output_format"] = 1 if not filtered_dict["multigraph"]: @@ -336,15 +325,15 @@ def _update_using_first_menu(result_dict, input_func): :type input_func : function object :return: result_dict as dict """ - MENU_ITEMS_KEYS1 = sorted(list(MENU_ITEMS1.keys())) + MENU_ITEMS_KEYS1 = sorted(list(pyrgg.params.MENU_ITEMS1.keys())) for item in MENU_ITEMS_KEYS1: while True: try: result_dict[item] = MENU_ITEM_CONVERTORS[item]( - input_func(MENU_ITEMS1[item]) + input_func(pyrgg.params.MENU_ITEMS1[item]) ) except Exception: - print(PYRGG_INPUT_ERROR_MESSAGE) + print(pyrgg.params.PYRGG_INPUT_ERROR_MESSAGE) else: break return result_dict @@ -360,17 +349,17 @@ def _update_using_second_menu(result_dict, input_func): :type input_func : function object :return: result_dict as dict """ - MENU_ITEMS_KEYS2 = sorted(list(MENU_ITEMS2.keys())) + MENU_ITEMS_KEYS2 = sorted(list(pyrgg.params.MENU_ITEMS2.keys())) for item in MENU_ITEMS_KEYS2: if not result_dict["weight"] and item in ["max_weight", "min_weight"]: continue while True: try: result_dict[item] = MENU_ITEM_CONVERTORS[item]( - input_func(MENU_ITEMS2[item]) + input_func(pyrgg.params.MENU_ITEMS2[item]) ) except Exception: - print(PYRGG_INPUT_ERROR_MESSAGE) + print(pyrgg.params.PYRGG_INPUT_ERROR_MESSAGE) else: break return result_dict @@ -625,7 +614,7 @@ def json_to_yaml(filename): with open(filename + ".yaml", "w") as yaml_file: yaml.safe_dump(json_data, yaml_file, default_flow_style=False) except FileNotFoundError: - print(PYRGG_FILE_ERROR_MESSAGE) + print(pyrgg.params.PYRGG_FILE_ERROR_MESSAGE) def json_to_pickle(filename): @@ -642,4 +631,4 @@ def json_to_pickle(filename): with open(filename + ".p", "wb") as pickle_file: pickle.dump(json_data, pickle_file) except FileNotFoundError: - print(PYRGG_FILE_ERROR_MESSAGE) + print(pyrgg.params.PYRGG_FILE_ERROR_MESSAGE) From ead25e4d5386e90c1348235686f034fa2c08928b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:28:21 +0430 Subject: [PATCH 54/61] fix : minor edit in branch_gen function #98 --- pyrgg/functions.py | 3 ++- pyrgg/params.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrgg/functions.py b/pyrgg/functions.py index 271b7f26..4ccc8fa2 100644 --- a/pyrgg/functions.py +++ b/pyrgg/functions.py @@ -488,7 +488,8 @@ def branch_gen( set(reference_vertices) - set(used_vertices[vertex_index])) if not self_loop and vertex_index in reference_vertices: reference_vertices.remove(vertex_index) - reference_vertices.sort() + if pyrgg.params.PYRGG_TEST_MODE: + reference_vertices.sort() while (index < threshold): vertex_degree = degree_dict[vertex_index] if vertex_degree >= max_edge: diff --git a/pyrgg/params.py b/pyrgg/params.py index 665c5b65..4a96dfb7 100644 --- a/pyrgg/params.py +++ b/pyrgg/params.py @@ -63,6 +63,8 @@ PYRGG_VERSION = "1.0" +PYRGG_TEST_MODE = False + SOURCE_DIR = os.getcwd() PYRGG_LINKS = """ From e073977cc14dbe34894c1e0cd2a3989cbc2bc4e2 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:32:40 +0430 Subject: [PATCH 55/61] fix : tests updated #98 --- pyrgg/test.py | 2 ++ test/functions_test.py | 2 ++ test/graph_gen_test.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pyrgg/test.py b/pyrgg/test.py index a6973f87..acdcc62c 100644 --- a/pyrgg/test.py +++ b/pyrgg/test.py @@ -2,11 +2,13 @@ """Test file.""" """ >>> from pyrgg import * +>>> import pyrgg.params >>> import random >>> import os >>> import json >>> import yaml >>> import pickle +>>> pyrgg.params.PYRGG_TEST_MODE = True >>> get_precision(2) 0 >>> get_precision(2.2) diff --git a/test/functions_test.py b/test/functions_test.py index 9695f718..40bb89b7 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- """ >>> from pyrgg.functions import * +>>> import pyrgg.params >>> import random >>> description_print() +>>> pyrgg.params.PYRGG_TEST_MODE = True Webpage : https://www.pyrgg.ir Repository : https://github.com/sepandhaghighi/pyrgg Paper : https://doi.org/10.21105/joss.00331 diff --git a/test/graph_gen_test.py b/test/graph_gen_test.py index ba0f52c7..c2547f1c 100644 --- a/test/graph_gen_test.py +++ b/test/graph_gen_test.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """ >>> from pyrgg import * +>>> import pyrgg.params >>> import random >>> import os >>> import json @@ -9,6 +10,7 @@ >>> from scipy.io import mmread >>> from networkx.readwrite.gml import read_gml >>> from networkx.readwrite.gexf import read_gexf +>>> pyrgg.params.PYRGG_TEST_MODE = True >>> random.seed(2) >>> dimacs_maker('testfile', 0, 200, 10, 0, 2, True,True,True,False) 7 From 97336acc18f98c031a200713da1104ae39370395 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:34:49 +0430 Subject: [PATCH 56/61] doc : CHANGELOG updated #98 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a945113..b3c3e4ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `requirements-splitter.py` - `is_weighted` function - `_write_properties_to_json` function +- `PYRGG_TEST_MODE` parameter ### Changed - Test system modified - JSON, YAML and Pickle formats value changed from `string` to `number` @@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `_write_to_json` function renamed to `_write_data_to_json` - `logger` function modified - `time_convert` function modified +- `branch_gen` function modified - References updated ## [1.0] - 2021-01-11 ### Added From 02f5718e29a4954d8643257b09a487efbc1d4194 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:45:04 +0430 Subject: [PATCH 57/61] fix : minor bug in functions_test fixed #98 --- test/functions_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functions_test.py b/test/functions_test.py index 40bb89b7..ffff8198 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -3,8 +3,8 @@ >>> from pyrgg.functions import * >>> import pyrgg.params >>> import random ->>> description_print() >>> pyrgg.params.PYRGG_TEST_MODE = True +>>> description_print() Webpage : https://www.pyrgg.ir Repository : https://github.com/sepandhaghighi/pyrgg Paper : https://doi.org/10.21105/joss.00331 From 9cec088dba9639caf47f7251a9433226f26bc25d Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 2 Jun 2021 00:55:31 +0430 Subject: [PATCH 58/61] fix : minor bug in functions_test fixed #98 --- test/functions_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functions_test.py b/test/functions_test.py index ffff8198..fa114c90 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -161,7 +161,7 @@ >>> prev_item = "" >>> input_func_dict = {"vertices":"120","max_weight":"110","min_weight":"0","min_edge":"1","max_edge":"1000","sign":"1","direct":"1","self_loop":"1","multigraph":"0","file_name":"File 1","output_format":"2","weight":"1","error":"120","number_of_files":3} >>> def input_func_test(input_data): -... menu = dict(MENU_ITEMS1,**MENU_ITEMS2) +... menu = dict(pyrgg.params.MENU_ITEMS1,**pyrgg.params.MENU_ITEMS2) ... global prev_item ... for item in menu: ... if input_data == menu[item]: From 4718c7a84bd437de2e42f50c79cd16b1625bec45 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 3 Jun 2021 16:45:56 +0430 Subject: [PATCH 59/61] doc : show-your-support section added to README --- README.md | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 106fe2ab..664b0e94 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ ---------- -## Table of contents +## Table of Contents * [Overview](https://github.com/sepandhaghighi/pyrgg#overview) * [Installation](https://github.com/sepandhaghighi/pyrgg#installation) * [Usage](https://github.com/sepandhaghighi/pyrgg#usage) * [Issues & Bug Reports](https://github.com/sepandhaghighi/pyrgg#issues--bug-reports) * [Todo](https://github.com/sepandhaghighi/pyrgg#todo) * [Sample Files](https://github.com/sepandhaghighi/pyrgg#sample-files) - * [Example Of Usage](https://github.com/sepandhaghighi/pyrgg#example-of-usage) + * [Example of Usage](https://github.com/sepandhaghighi/pyrgg#example-of-usage) * [Supported Formats](https://github.com/sepandhaghighi/pyrgg#supported-formats) * [Similar Works](https://github.com/sepandhaghighi/pyrgg#similar-works) * [Dependencies](https://github.com/sepandhaghighi/pyrgg#dependencies) @@ -33,7 +33,7 @@ * [Citing](https://github.com/sepandhaghighi/pyrgg#citing) * [Authors](https://github.com/sepandhaghighi/pyrgg/blob/master/AUTHORS.md) * [License](https://github.com/sepandhaghighi/pyrgg#license) - * [Donate](https://github.com/sepandhaghighi/pyrgg#donate-to-our-project) + * [Show Your Support](https://github.com/sepandhaghighi/pyrgg#show-your-support) * [Changelog](https://github.com/sepandhaghighi/pyrgg/blob/master/CHANGELOG.md) * [Code of Conduct](https://github.com/sepandhaghighi/pyrgg/blob/master/.github/CODE_OF_CONDUCT.md) @@ -198,7 +198,7 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). -## Example Of Usage +## Example of Usage - Generate synthetic data for graph processing frameworks (some of them mentioned here) performance-analysis @@ -570,15 +570,32 @@ If you use pyrgg in your research, please cite the [JOSS paper](http://joss.theo
12- Zhong, Jianlong, and Bingsheng He. "An overview of medusa: simplified graph processing on gpus." ACM SIGPLAN Notices 47.8 (2012): 283-284.
-## Donate to our project - - -

Bitcoin :

- -```1XGr9qbZjBpUQJJSB6WtgBQbDTgrhPLPA``` - - - -

Payping (For Iranian citizens) :

- - \ No newline at end of file +## Show Your Support + +

Star This Repo

+ +Give a ⭐️ if this project helped you! + +

Donate to Our Project

+ +

Bitcoin

+1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy +

Ethereum

+0xcD4Db18B6664A9662123D4307B074aE968535388 +

Litecoin

+Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ +

Doge

+DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh +

Tron

+TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7 +

Ripple

+rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq +

Binance Coin

+bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef +

Tether

+0xcD4Db18B6664A9662123D4307B074aE968535388 +

Dash

+Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s +

Stellar

+ +GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL \ No newline at end of file From 051ee052d041ddc83d3196bff388d7e31dbee546 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 3 Jun 2021 16:51:04 +0430 Subject: [PATCH 60/61] rel : migrate to version 1.1 --- CHANGELOG.md | 4 +++- README.md | 8 ++++---- otherfile/Version.rc | 8 ++++---- otherfile/version_check.py | 2 +- pyrgg/params.py | 2 +- setup.py | 5 +++-- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c3e4ee..c90bbcca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.1] - 2021-06-09 ### Added - `requirements-splitter.py` - `is_weighted` function @@ -127,7 +128,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - JSON format - README -[Unreleased]: https://github.com/sepandhaghighi/pyrgg/compare/v1.0...dev +[Unreleased]: https://github.com/sepandhaghighi/pyrgg/compare/v1.1...dev +[1.1]: https://github.com/sepandhaghighi/pyrgg/compare/v1.0...v1.1 [1.0]: https://github.com/sepandhaghighi/pyrgg/compare/v0.9...v1.0 [0.9]: https://github.com/sepandhaghighi/pyrgg/compare/v0.8...v0.9 [0.8]: https://github.com/sepandhaghighi/pyrgg/compare/v0.7...v0.8 diff --git a/README.md b/README.md index 664b0e94..e7750d67 100644 --- a/README.md +++ b/README.md @@ -86,14 +86,14 @@ Pyrgg target audiences are computer scientists who study graph algorithms and gr ## Installation ### Source Code -- Download [Version 1.0](https://github.com/sepandhaghighi/pyrgg/archive/v1.0.zip) or [Latest Source ](https://github.com/sepandhaghighi/pyrgg/archive/dev.zip) +- Download [Version 1.1](https://github.com/sepandhaghighi/pyrgg/archive/v1.1.zip) or [Latest Source ](https://github.com/sepandhaghighi/pyrgg/archive/dev.zip) - `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 - Check [Python Packaging User Guide](https://packaging.python.org/installing/) -- `pip install pyrgg==1.0` or `pip3 install pyrgg==1.0` (Need root access) +- `pip install pyrgg==1.1` or `pip3 install pyrgg==1.1` (Need root access) ### Conda @@ -101,8 +101,8 @@ Pyrgg target audiences are computer scientists who study graph algorithms and gr - `conda install -c sepandhaghighi pyrgg` (Need root access) ### Exe Version (Only Windows) -- Download [Exe-Version 1.0](https://github.com/sepandhaghighi/pyrgg/releases/download/v1.0/PYRGG-1.0.exe) -- Run `PYRGG-1.0.exe` +- Download [Exe-Version 1.1](https://github.com/sepandhaghighi/pyrgg/releases/download/v1.1/PYRGG-1.1.exe) +- Run `PYRGG-1.1.exe` ### System Requirements Pyrgg will likely run on a modern dual core PC. Typical configuration is: diff --git a/otherfile/Version.rc b/otherfile/Version.rc index 4608b2e8..cf4106fd 100644 --- a/otherfile/Version.rc +++ b/otherfile/Version.rc @@ -1,7 +1,7 @@ VSVersionInfo( ffi=FixedFileInfo( - filevers=(1, 0, 0, 0), - prodvers=(1, 0, 0, 0), + filevers=(1, 1, 0, 0), + prodvers=(1, 1, 0, 0), mask=0x3f, flags=0x0, OS=0x40004, @@ -16,12 +16,12 @@ VSVersionInfo( u'040904B0', [StringStruct(u'CompanyName', u'Sepand Haghighi'), StringStruct(u'FileDescription', u'PYRGG.exe'), - StringStruct(u'FileVersion', u'1.0.0.0'), + StringStruct(u'FileVersion', u'1.1.0.0'), StringStruct(u'InternalName', u'PYRGG.exe'), StringStruct(u'LegalCopyright', u'Copyright (c) 2021 Sepand Haghighi'), StringStruct(u'OriginalFilename', u'PYRGG.exe'), StringStruct(u'ProductName', u'PYRGG'), - StringStruct(u'ProductVersion', u'1, 0, 0, 0')]) + StringStruct(u'ProductVersion', u'1, 1, 0, 0')]) ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ] diff --git a/otherfile/version_check.py b/otherfile/version_check.py index b12a1003..5c754ed7 100644 --- a/otherfile/version_check.py +++ b/otherfile/version_check.py @@ -4,7 +4,7 @@ import sys import codecs Failed = 0 -VERSION = "1.0" +VERSION = "1.1" VERSION_1 = VERSION.split(".")[0] VERSION_2 = str(int(float(VERSION) * 10 - int(VERSION_1) * 10)) diff --git a/pyrgg/params.py b/pyrgg/params.py index 4a96dfb7..bb224603 100644 --- a/pyrgg/params.py +++ b/pyrgg/params.py @@ -61,7 +61,7 @@ } -PYRGG_VERSION = "1.0" +PYRGG_VERSION = "1.1" PYRGG_TEST_MODE = False diff --git a/setup.py b/setup.py index 10adc0d8..1c60d837 100644 --- a/setup.py +++ b/setup.py @@ -44,14 +44,14 @@ def read_description(): setup( name='pyrgg', packages=['pyrgg'], - version='1.0', + version='1.1', description='Python Random Graph Generator', long_description=read_description(), long_description_content_type='text/markdown', author='Sepand Haghighi', author_email='info@pyrgg.ir', url='https://github.com/sepandhaghighi/pyrgg', - download_url='https://github.com/sepandhaghighi/pyrgg/tarball/v1.0', + download_url='https://github.com/sepandhaghighi/pyrgg/tarball/v1.1', keywords='random graph python3 python generator graph-process generator DIMACS JSON YAML Pickle CSV TSV WEL ASP TGF UCINET', project_urls={ 'Webpage': 'https://www.pyrgg.ir', @@ -69,6 +69,7 @@ def read_description(): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Intended Audience :: Developers', 'Intended Audience :: Education', 'Intended Audience :: End Users/Desktop', From dad88979f9c084ff17a1cadab96933530ad3ca1f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 9 Jun 2021 13:19:52 +0430 Subject: [PATCH 61/61] doc : sample files updated --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e7750d67..521a5640 100644 --- a/README.md +++ b/README.md @@ -166,20 +166,20 @@ or send an email to [info@pyrgg.ir](mailto:info@pyrgg.ir "info@pyrgg.ir"). - [Sample 2-DIMACS](https://www.dropbox.com/s/lqk42pwu7o4xauv/1000.gr.gz?dl=0) (1000 Vertices , 13KB) - [Sample 3-DIMACS](https://www.dropbox.com/s/93dp8cjs6lnu83u/1000000.gr.gz?dl=0) (1000000 Vertices , 7MB) - [Sample 4-DIMACS](https://www.dropbox.com/s/rrxdc4wt0ldonfk/5000000.gr.gz?dl=0) (5000000 Vertices , 37MB) -- [Sample 1-JSON](https://www.dropbox.com/s/yvevoyb8559nytb/100.json?dl=0) (100 Vertices , 11KB) -- [Sample 2-JSON](https://www.dropbox.com/s/f6kljlch7p2rfhy/1000.json?dl=0) (1000 Vertices , 105KB) +- [Sample 1-JSON](https://www.dropbox.com/s/yvevoyb8559nytb/100.json?dl=0) (100 Vertices , 26KB) +- [Sample 2-JSON](https://www.dropbox.com/s/f6kljlch7p2rfhy/1000.json?dl=0) (1000 Vertices , 494KB) - [Sample 1-CSV](https://www.dropbox.com/s/dmld0eadftnatr5/100.csv?dl=0) (100 Vertices , 3KB) - [Sample 2-CSV](https://www.dropbox.com/s/juxah4nwamzdegr/1000.csv?dl=0) (1000 Vertices , 51KB) - [Sample 1-TSV](https://www.dropbox.com/s/j3zgs4kx2paxe75/100.tsv?dl=0) (100 Vertices , 29KB) - [Sample 2-TSV](https://www.dropbox.com/s/ykagmjgwlpim6dq/1000.tsv?dl=0) (1000 Vertices , 420KB) - [Sample 1-WEL](https://www.dropbox.com/s/moie1xb2wj90y33/100.wel?dl=0) (100 Vertices , 5KB) - [Sample 2-WEL](https://www.dropbox.com/s/h6pohl60okhdnt7/1000.wel?dl=0) (1000 Vertices , 192KB) -- [Sample 1-YAML](https://www.dropbox.com/s/9seljohtoqjzjzy/30.yaml?dl=0) (30 Vertices , 3KB) -- [Sample 2-YAML](https://www.dropbox.com/s/wtfh38rgmn29npi/100.yaml?dl=0) (100 Vertices , 12KB) +- [Sample 1-YAML](https://www.dropbox.com/s/9seljohtoqjzjzy/30.yaml?dl=0) (30 Vertices , 6KB) +- [Sample 2-YAML](https://www.dropbox.com/s/wtfh38rgmn29npi/100.yaml?dl=0) (100 Vertices , 35KB) - [Sample 1-LP](https://www.dropbox.com/s/4bufa1m4uamv48z/100.lp?dl=0) (100 Vertices , 7KB) - [Sample 2-LP](https://www.dropbox.com/s/w79fh1qva64namw/1000.lp?dl=0) (1000 Vertices , 76KB) -- [Sample 1-Pickle](https://www.dropbox.com/s/4s8zt9i13z39gts/100.p?dl=0) (100 Vertices , 15KB) -- [Sample 2-Pickle](https://www.dropbox.com/s/fzurqu5au0p1b54/1000.p?dl=0) (1000 Vertices , 209KB) +- [Sample 1-Pickle](https://www.dropbox.com/s/4s8zt9i13z39gts/100.p?dl=0) (100 Vertices , 12KB) +- [Sample 2-Pickle](https://www.dropbox.com/s/fzurqu5au0p1b54/1000.p?dl=0) (1000 Vertices , 340KB) - [Sample 1-TGF](https://www.dropbox.com/s/tehb6f3gz2o5v9c/100.tgf?dl=0) (100 Vertices , 4KB) - [Sample 2-TGF](https://www.dropbox.com/s/9mjeq4w973189cc/1000.tgf?dl=0) (1000 Vertices , 61KB) - [Sample 1-UCINET DL](https://www.dropbox.com/s/82wrl86uowwjud2/100.dl?dl=0) (100 Vertices , 8KB)