Skip to content

Commit

Permalink
Merge pull request #38 from sepandhaghighi/dev
Browse files Browse the repository at this point in the history
Version 0.7
  • Loading branch information
sadrasabouri authored Aug 7, 2020
2 parents d30c1b9 + dee980b commit 5535db7
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 38 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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]
## [0.7] - 2020-08-07
### Added
- Graph Line format
### Changed
- Menu optimized
## [0.6] - 2020-07-24
### Added
- Matrix Market format
Expand Down Expand Up @@ -65,7 +70,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/v0.6...dev
[Unreleased]: https://github.com/sepandhaghighi/pyrgg/compare/v0.7...dev
[0.7]: https://github.com/sepandhaghighi/pyrgg/compare/v0.6...v0.7
[0.6]: https://github.com/sepandhaghighi/pyrgg/compare/v0.5...v0.6
[0.5]: https://github.com/sepandhaghighi/pyrgg/compare/v0.4...v0.5
[0.4]: https://github.com/sepandhaghighi/pyrgg/compare/v0.3...v0.4
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,23 @@ Pyrgg target audiences are computer scientists who study graph algorithms and gr
## Installation

### Source Code
- Download [Version 0.6](https://github.com/sepandhaghighi/pyrgg/archive/v0.6.zip) or [Latest Source ](https://github.com/sepandhaghighi/pyrgg/archive/dev.zip)
- Download [Version 0.7](https://github.com/sepandhaghighi/pyrgg/archive/v0.7.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==0.6` or `pip3 install pyrgg==0.6` (Need root access)
- `pip install pyrgg==0.7` or `pip3 install pyrgg==0.7` (Need root access)

### Conda

- Check [Conda Managing Package](https://conda.io)
- `conda install -c sepandhaghighi pyrgg` (Need root access)

### Exe Version (Only Windows)
- Download [Exe-Version 0.6](https://github.com/sepandhaghighi/pyrgg/releases/download/v0.6/PYRGG-0.6.exe)
- Run `PYRGG-0.6.exe`
- Download [Exe-Version 0.7](https://github.com/sepandhaghighi/pyrgg/releases/download/v0.7/PYRGG-0.7.exe)
- Run `PYRGG-0.7.exe`

### System Requirements
Pyrgg will likely run on a modern dual core PC. Typical configuration is:
Expand Down Expand Up @@ -186,6 +186,8 @@ or send an email to [[email protected]](mailto:[email protected] "[email protected]").
- [Sample 2-UCINET DL](https://www.dropbox.com/s/kbzbsy47uvfqdsi/1000.dl?dl=0) (1000 Vertices , 729KB)
- [Sample 1-MTX](https://www.dropbox.com/s/ztw3vg0roups82q/100.mtx?dl=0) (100 Vertices , 59KB)
- [Sample 2-MTX](https://www.dropbox.com/s/skjjvbbzrpvryl4/1000.mtx?dl=0) (1000 Vertices , 1.8MB)
- [Sample 1-GL](https://www.dropbox.com/s/obmmb5nw1lca9z3/100.gl?dl=0) (100 Vertices , 17KB)
- [Sample 2-GL](https://www.dropbox.com/s/intufsbudnmfv8m/1000.gl?dl=0) (1000 Vertices , 2.4MB)



Expand Down Expand Up @@ -363,6 +365,15 @@ or send an email to [[email protected]](mailto:[email protected] "[email protected]").
.
<head_n> <tail_n> <weight_n>
```
- Graph Line(.gl)
```
<head_1> <tail_1>:<weight_1> <tail_2>:<weight_2> ... <tail_n>:<weight_n>
<head_2> <tail_1>:<weight_1> <tail_2>:<weight_2> ... <tail_n>:<weight_n>
.
.
.
<head_n> <tail_1>:<weight_1> <tail_2>:<weight_2> ... <tail_n>:<weight_n>
```
- [Pickle(.p)](https://docs.python.org/3.5/library/pickle.html) (Binary Format)


Expand Down
8 changes: 4 additions & 4 deletions otherfile/Version.rc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VSVersionInfo(
ffi=FixedFileInfo(
filevers=(0, 6, 0, 0),
prodvers=(0, 6, 0, 0),
filevers=(0, 7, 0, 0),
prodvers=(0, 7, 0, 0),
mask=0x3f,
flags=0x0,
OS=0x40004,
Expand All @@ -16,12 +16,12 @@ VSVersionInfo(
u'040904B0',
[StringStruct(u'CompanyName', u'Sepand Haghighi'),
StringStruct(u'FileDescription', u'PYRGG.exe'),
StringStruct(u'FileVersion', u'0.6.0.0'),
StringStruct(u'FileVersion', u'0.7.0.0'),
StringStruct(u'InternalName', u'PYRGG.exe'),
StringStruct(u'LegalCopyright', u'Copyright (c) 2020 Sepand Haghighi'),
StringStruct(u'OriginalFilename', u'PYRGG.exe'),
StringStruct(u'ProductName', u'PYRGG'),
StringStruct(u'ProductVersion', u'0, 6, 0, 0')])
StringStruct(u'ProductVersion', u'0, 7, 0, 0')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
Expand Down
2 changes: 1 addition & 1 deletion otherfile/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import codecs
Failed = 0
VERSION = "0.6"
VERSION = "0.7"

VERSION_1 = VERSION.split(".")[0]
VERSION_2 = str(int(float(VERSION) * 10 - int(VERSION_1) * 10))
Expand Down
3 changes: 2 additions & 1 deletion pyrgg/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
8: dl_maker,
9: tgf_maker,
10: tsv_maker,
11: mtx_maker}
11: mtx_maker,
12: gl_maker}


def run():
Expand Down
33 changes: 17 additions & 16 deletions pyrgg/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import os

MENU_ITEMS1 = {
"file_name": "File Name : ",
"output_format": "Graph Formats : \n1- DIMACS(.gr)\n2- JSON(.json)\n3- CSV(.csv)\n4- YAML(.yaml)\n5- WEL(.wel)\n6- ASP(.lp)\n7- Pickle(.p)\n8- UCINET DL(.dl)\n9- TGF(.tgf)\n10- TSV("
".tsv)\n11- Matrix Market(.mtx)\n",
"weight": "Weighted[1] or Unweighted[2]"}

MENU_ITEMS2 = {"vertices": "Vertices Number : ",
"max_weight": "Max Weight : ",
"min_weight": "Min Weight : ",
"min_edge": "Min Edge Number :",
"max_edge": "Max Edge Number :",
"sign": "Signed[1] or Unsigned[2]",
"direct": "Directed[1] or Undirected[2]",
"self_loop": "Self Loop[1] or No Self Loop[2]",
"multigraph": "Simple[1] or Multigraph[2]"}
"file_name": "- File Name : ",
"output_format": "- Graph Formats : \n1- DIMACS(.gr)\n2- JSON(.json)\n3- CSV(.csv)\n4- YAML(.yaml)\n5- WEL(.wel)\n6- ASP(.lp)\n7- Pickle(.p)\n8- UCINET DL(.dl)\n9- TGF(.tgf)\n10- TSV("
".tsv)\n11- Matrix Market(.mtx)\n12- Graph Line(.gl)\n",
"weight": "- Weighted[1] or Unweighted[2]"}

MENU_ITEMS2 = {"vertices": "- Vertices Number : ",
"max_weight": "- Max Weight : ",
"min_weight": "- Min Weight : ",
"min_edge": "- Min Edge Number :",
"max_edge": "- Max Edge Number :",
"sign": "- Signed[1] or Unsigned[2]",
"direct": "- Directed[1] or Undirected[2]",
"self_loop": "- Self Loop[1] or No Self Loop[2]",
"multigraph": "- Simple[1] or Multigraph[2]"}


SUFFIX_MENU = {
Expand All @@ -30,10 +30,11 @@
8: ".dl",
9: ".tgf",
10: ".tsv",
11: ".mtx"}
11: ".mtx",
12: ".gl"}


PYRGG_VERSION = "0.6"
PYRGG_VERSION = "0.7"

SOURCE_DIR = os.getcwd()

Expand Down
61 changes: 60 additions & 1 deletion pyrgg/pyrgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def input_filter(input_dict):
filtered_dict["self_loop"] = 1
if filtered_dict["multigraph"] not in [1, 2]:
filtered_dict["multigraph"] = 1
if filtered_dict["output_format"] not in list(range(1, 12)):
if filtered_dict["output_format"] not in list(range(1, len(SUFFIX_MENU) + 1)):
filtered_dict["output_format"] = 1
return filtered_dict

Expand Down Expand Up @@ -993,6 +993,65 @@ def tgf_maker(
return edge_number


def gl_maker(
file_name,
min_weight,
max_weight,
vertices,
min_edge,
max_edge,
sign,
direct,
self_loop,
multigraph):
"""
Create output file in Graph Line(GL).
:param file_name: file name
:type file_name: str
:param min_weight: weight min range
:type min_weight: int
:param max_weight: weight max range
:type max_weight: int
:param vertices: number of vertices
:type vertices: int
:param min_edge : minimum edge number
:type min_edge : int
:param max_edge : maximum edge number
:type max_edge : int
:param sign: weight sign flag
:type sign: int
:param direct: directed and undirected graph flag
:type direct: int
:param self_loop: self loop flag
:type self_loop: int
:param multigraph: multigraph flag
:type multigraph: int
:return: edge_number as int
"""
file = open(file_name + ".gl", "w")
dicts = edge_gen(
vertices,
min_weight,
max_weight,
min_edge,
max_edge,
sign,
direct,
self_loop,
multigraph)
edge_dic = dicts[0]
weight_dic = dicts[1]
edge_number = dicts[2]
for i in edge_dic.keys():
line_data = str(i)
for j, value in enumerate(edge_dic[i]):
line_data += " " + str(value) + ":" + str(weight_dic[i][j])
file.write(line_data + "\n")
file.close()
return edge_number


def dl_maker(
file_name,
min_weight,
Expand Down
26 changes: 22 additions & 4 deletions pyrgg/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,22 @@
9 8 -97
10 9 143
<BLANKLINE>
>>> random.seed(2)
>>> gl_maker('testfile', 0, 200, 10, 0, 2, 0, 1,1,1)
7
>>> file=open('testfile.gl','r')
>>> print(file.read())
1
2
3
4 3:-64
5 4:148 3:-163
6 9:-139
7 9:-9
8
9 8:-97
10 9:143
<BLANKLINE>
>>> file=open('testfile.csv','r')
>>> print(file.read())
4,3,-64
Expand Down Expand Up @@ -1119,19 +1135,19 @@
>>> input_dic['sign']
2
>>> input_dic['vertices']
18
20
>>> input_dic['min_edge']
17
19
>>> input_dic['min_weight']
1
>>> input_dic['output_format']
1
>>> input_dic['max_weight']
1
>>> input_dic['file_name']
'12'
'14'
>>> input_dic['max_edge']
17
19
>>> random.seed(2)
>>> tgf_maker('testfile', 0, 200, 10, 0, 2, 0, 1, 1,1)
7
Expand Down Expand Up @@ -1313,6 +1329,8 @@
>>> os.remove('testfile.tgf')
>>> os.remove('testfile.wel')
>>> os.remove('testfile.yaml')
>>> os.remove('testfile.mtx')
>>> os.remove('testfile.gl')
>>> os.remove('testfile2.csv')
>>> os.remove('testfile2.dl')
>>> os.remove('testfile2.gr')
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def read_description():
setup(
name='pyrgg',
packages=['pyrgg'],
version='0.6',
version='0.7',
description='Python Random Graph Generator',
long_description=read_description(),
long_description_content_type='text/markdown',
author='Sepand Haghighi',
author_email='[email protected]',
url='https://github.com/sepandhaghighi/pyrgg',
download_url='https://github.com/sepandhaghighi/pyrgg/tarball/v0.6',
download_url='https://github.com/sepandhaghighi/pyrgg/tarball/v0.7',
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',
Expand Down
Loading

0 comments on commit 5535db7

Please sign in to comment.