Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total Number of Edges #52

Merged
merged 6 commits into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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]
### Changed
- Menu optimized
### Added
- GEXF format
## [0.8] - 2020-08-19
Expand Down
3 changes: 2 additions & 1 deletion pyrgg/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def run():
second_time = time.perf_counter()
elapsed_time = second_time - first_time
elapsed_time_format = time_convert(str(elapsed_time))
print("Graph Generated In " + elapsed_time_format)
print("Total Number of Edges : " + str(edge_number))
print("Graph Generated in " + elapsed_time_format)
print("Where --> " + SOURCE_DIR)
logger(
vertices_number,
Expand Down
4 changes: 2 additions & 2 deletions pyrgg/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
MENU_ITEMS2 = {"vertices": "- Vertices Number : ",
"max_weight": "- Max Weight : ",
"min_weight": "- Min Weight : ",
"min_edge": "- Min Edge Number :",
"max_edge": "- Max Edge Number :",
"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]",
Expand Down
34 changes: 17 additions & 17 deletions pyrgg/pyrgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,47 +1306,47 @@ def gexf_maker(
weight_dic = dicts[1]
edge_number = dicts[2]
header = '<?xml version="1.0" encoding="UTF-8"?>\n'
header +='<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">\n'
header += '<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">\n'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this I've done it because it seemed more aligned in comparison with it's earlier line.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem ;-)
It's just a PEP8 rule

date = datetime.datetime.now().date()
meta = ' <meta lastmodifieddate="{0}">\n'.format(date)
meta +=' <creator>PyRGG</creator>\n'
meta +=' <description>{0}</description>\n'.format(file_name)
meta +=' </meta>\n'
meta = " " * 4 + '<meta lastmodifieddate="{0}">\n'.format(date)
meta += " " * 8 + '<creator>PyRGG</creator>\n'
meta += " " * 8 + '<description>{0}</description>\n'.format(file_name)
meta += " " * 4 + '</meta>\n'
Comment on lines +1311 to +1314
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

file.write(header)
file.write(meta)
if direct == 1:
defaultedgetype = "directed"
else:
defaultedgetype = "undirected"
file.write(
' <graph defaultedgetype="' + defaultedgetype + '">\n'
" " * 4 + '<graph defaultedgetype="' + defaultedgetype + '">\n'
)
file.write(" <nodes>\n")
file.write(" " * 8 + "<nodes>\n")
for i in edge_dic.keys():
file.write(
" " +
" " * 12 +
'<node id="' +
str (i) + '"' +
str(i) + '"' +
' label="Node {0}" />'.format(
str(i)) + "\n")
file.write(" </nodes>\n")
file.write(" <edges>\n")
str(i)) + "\n")
file.write(" " * 8 + "</nodes>\n")
file.write(" " * 8 + "<edges>\n")
edge_id = 1
for i in edge_dic.keys():
for j, value in enumerate(edge_dic[i]):
file.write(
" " +
" " * 12 +
'<edge id="' +
str (edge_id) + '"' +
str(edge_id) + '"' +
' source="' +
str(i) + '"'
' target="' +
str(value) + '"' +
' weight="{0}" />'.format(
str(weight_dic[i][j])) + "\n")
str(weight_dic[i][j])) + "\n")
edge_id += 1
file.write(" </edges>\n")
file.write(" </graph>\n")
file.write(" " * 8 + "</edges>\n")
file.write(" " * 4 + "</graph>\n")
file.write("</gexf>")
file.close()
return edge_number
Expand Down
4 changes: 2 additions & 2 deletions pyrgg/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@
>>> input_dic['vertices']
20
>>> input_dic['min_edge']
19
20
Copy link
Collaborator

@sadrasabouri sadrasabouri Aug 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what it is this for?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a space to "Min Edge" and "Max Edge" in menu

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah

>>> input_dic['min_weight']
1
>>> input_dic['output_format']
Expand All @@ -1278,7 +1278,7 @@
>>> input_dic['file_name']
'14'
>>> input_dic['max_edge']
19
20
>>> random.seed(2)
>>> tgf_maker('testfile', 0, 200, 10, 0, 2, 0, 1, 1,1)
7
Expand Down
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@
>>> input_dic['vertices']
20
>>> input_dic['min_edge']
19
20
>>> input_dic['min_weight']
1
>>> input_dic['output_format']
Expand All @@ -1697,7 +1697,7 @@
>>> input_dic['file_name']
'14'
>>> input_dic['max_edge']
19
20
>>> random.seed(2)
>>> tgf_maker('testfile', 0, 200, 10, 0, 2, 0, 1,1,1)
7
Expand Down