sepandhaghighi / pyrgg Goto Github PK
View Code? Open in Web Editor NEW🔧 Python Random Graph Generator
Home Page: https://www.pyrgg.site
License: MIT License
🔧 Python Random Graph Generator
Home Page: https://www.pyrgg.site
License: MIT License
Support .tsv
format
Migrating from Travis/Appveyor to GitHub Actions
max_edge is not working as expected.
csv_maker('testfile',0,100,10,0,3,True,True,False,False);print(open('testfile.csv','r').read())
Give an output with at most 3 edges.
It has got 11 edges as below:
>>> csv_maker('testfile',0,100,10,0,3,True,True,False,False);print(open('testfile.csv','r').read())
11
1,7,-64
2,10,-19
2,9,-76
2,8,-94
4,6,-14
4,5,35
5,1,-66
5,3,25
6,8,-26
9,3,-26
9,10,-15
MacOS big sur.
Python 3.9.12
Pyrgg 1.1
Support floating-point weights
Graph-Line format
0 1:4 2:4 3:1 4:4 5:4 6:2 7:1 8:1 9:4
<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>
Hi,
I am trying to use pyrgg with me own python application, could you please provide an example usage of importing pyrgg as a library in python?
Graph-Line format empty line should be removed
>>> file=open('testfile.gl','r')
>>> print(file.read())
1 2:92
2 5:-155
3 10:148
4 7:-185
5 9:-128
6 1:93 9:-97
7 3:60
8 4:-44
10 10:114
1 2:92
2 5:-155
3 10:148
4 7:-185
5 9:-128
6 1:93 9:-97
7 3:60
8 4:-44
9
10 10:114
Windows 10
3.5.2
0.8
Python 3.12 support
Change PyRGG structure to support different engines.
It has been observed that some metadata, such as max-weight
, min-weight
, max-edge
, min-edge
, self-loop
, and multigraph
, may contain inaccuracies.
We have two options:
Optimize logger function
2020-09-09 16:58:02
Filename : test2.gr
Vertices : 2
Total Edges : 4
Max Edge: x
Min Edge: x
Directed: True/False
Signed: True/False
Multigraph: True/False
Self Loop: True/False
Weighted: True/False
Max Weight: x
Min Weight: x
Elapsed Time : 00 days, 00 hour, 00 minutes, 20 seconds
2020-09-09 16:58:02.103878
Filename : test2.gr
Vertices : 2
Edges : 4
Elapsed Time : 00 days, 00 hour, 00 minutes, 20 seconds
Windows 10
3.5.2
0.8
Support Python 3.10
Update references section
DOT is a graph description language. DOT graphs are typically files with the filename extension .gv
or .dot
. The extension .gv
is preferred, to avoid confusion with the extension dot used by versions of Microsoft Word before 2007. Various programs can process DOT files.
References:
Save and load different configs in a config file
When JSON files are generated using PyRGG, whether directed or not - there is no distinction in the JSON for it.
Add a new properties
object to the root of the file which will contain details of the properties set in the generation such as:
directed
signed
multigraph
weighted
self loops
signed
All of those should be boolean
variables.
Those properties can't be found currently.
v1.0
Anaconda workflow
Some formats are too slow :
Windows 10
Python 3.5.2
0.5
Add Erdős–Rényi engine
References:
I think pyrgg
is now an executable script that takes the graph specifications and outputs a file containing a random graph.
What if someone wants to generate a random graph in their own code and have a graph object?
My suggestion is to divide the current program into two parts.
pyrgg
, uses the functional core and stores graphs in the files.Maybe these steps:
pyrgg
.We need to enable support for directed graphs in this engine.
Originally posted by @sepandhaghighi in #146 (comment)
GML format
Reference : https://gephi.org/users/supported-graph-formats/gml-format/
graph
[
multigraph 0
directed 0
node
[
id A
]
node
[
id B
]
node
[
id C
]
edge
[
source B
target A
value W1
]
edge
[
source C
target A
value W2
]
]
Hi, are you going to support formats like MatrixMarket and SNAP?
Print number of edges at the end of generation
Update snapshots and screen record
Currently when a new JSON graph is being generated, PyRGG generates a graph
object which is redundant.
Have nodes
and edges
in the root of the JSON file:
{
"nodes" : [
{"id": "1"},
{...}
],
"edges" : [
{
"source": "1",
"target": "4",
"weight": "8"
},
{...}
]
}
If it is done because you are laying the ground for some future work regarding graph properties - you could maybe add a new properties
objects at the JSON root.
{
"graph" : {
"nodes" : [
{"id": "1"},
{...}
],
"edges" : [
{
"source": "1",
"target": "4",
"weight": "8"
},
{...}
]
}
}
v1.0
Missing statement of need: the software generates random graphs, but the user can only choose the number of vertices, min and max weight for the edges, and a range for a random number of edges. I would expect a useful random graph generator to provide some more options, like connectivity, min, max and avg degree.
Example usage: the README.md states that the output can be used as input to other programs, but have the files generated by this program ever been used as an input to some other algorithm? how?
Tests: no tests provided
Other:
Sometimes it can be useful if we make a visualized output which helps the user making some sort of illustration about recently made graph.
It can be shown after each time of generation in pyrgg
menu.
networkX
has something like this, you can see it in the link bellow:
https://www.python-course.eu/networkx.php
GEXF Format
<?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
<meta lastmodifieddate="2009-03-20">
<creator>PyRGG</creator>
<description>File Name</description>
</meta>
<graph defaultedgetype="directed">
<nodes>
<node id="1" label="Node 1" />
<node id="2" label="Node 2" />
...
</nodes>
<edges>
<edge id="1" source="1" target="2" weight="400" />
...
</edges>
</graph>
</gexf>
Reference : https://github.com/gephi/gexf/wiki/Basic-Concepts#network-topology
Add a github action to publish package
Rename max_range
and min_range
parameters to max_weight
and min_weight
Line 502 in 622bfce
This line is time-consuming (about 60% of the total time!!).
We need it only for tests, so I think we can bypass it by a flag in the normal run.
Currently the nodes
array in the JSON file is full of objects for each nodes - each containing only the id
field.
I think that it would be much better to just get rid of those objects and replace them all with the IDs themselves.
Speedup edge_gen
function
Currently when a new JSON graph is created all numeric values are written as strings even though they can be integers.
Have a JSON file with IDs, (including "source" and "target") as integers.
All those fields are strings
v1.0
Get files number from user
Add console_scripts
entry point to setup.py
to run PyRGG directly from the terminal.
pyrgg
instead of
python -m pyrgg
In main menu each flag assigned by 1
or 2
, but it seems more friendly if it changes to 0
or 1
.
In second situation debugging may be more easy.
This issue may include these flags:
weighted
direct
self_loop
multigraph
(which can be changed to singlegraph
to seems more ordered)The generated graph in yaml format is not a DAG graph, however, during configuration phase directed option is chosen. Please let me know if there is a solution to this issue. Please have a look at the generated file using the link below :
https://drive.google.com/file/d/1o2WODs34h2pwAeOgItcmTgjxT6mA0zjD/view?usp=sharing
You can find the loop in these nodes: [[4, 7, 10], [1, 5, 9]]
Directed acyclic graph
Looped graph
Linux
PYthon 3.7.5
V1.0
The documentation (or at least the asciinema
clip) needs to be updated to version v1.1
GDF format
Reference :
nodedef>name VARCHAR,label VARCHAR
s1,Site number 1
s2,Site number 2
s3,Site number 3
edgedef>node1 VARCHAR,node2 VARCHAR, weight DOUBLE
s1,s2,122
s2,s3,45
s3,s2,12
s3,s1,5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.