-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Changes from all commits
d8fc26c
9a57214
292da7d
138ab60
a48820a
19e3ffb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1268,7 +1268,7 @@ | |
>>> input_dic['vertices'] | ||
20 | ||
>>> input_dic['min_edge'] | ||
19 | ||
20 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what it is this for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a space to "Min Edge" and "Max Edge" in menu There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah |
||
>>> input_dic['min_weight'] | ||
1 | ||
>>> input_dic['output_format'] | ||
|
@@ -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 | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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