Just little project of graph visualizer and generator. Supports random generation and graphical output.
Basic example:
python main.py --color 0 0 255 random 10
This will generate random graph and display it with blue lines color.
For more examples see "Command examples"
- pygame==1.9.6 (graphics support)
- click==7.0 (CLI support)
Usage: python main.py [options] <command> [options] <parameters>
Options:
- --width - sets up lines width
- --color - sets up lines color (RGB)
- --vsize - vertices circle radius
- --screen - sets up window size
Commands:
- random - generate graph and show it
- matrix - take adjacency matrix by stdin and visualize graph
Usage: python main.py [options] random [options] N
N - count of vertices in graph
Options:
- --fill - how much edges will be generated between vertices (between 0 and 1)
- --weights - range of weights to generate (include both borders)
Usage: python main.py [options] matrix N
Than you should input N lines of adjacency matrix. Or just paste from buffer.
N - count of vertices in graph
Without options
- Basic example, will be generated graph with 10 vertices, random weights and connections
python main.py random 10
- Customize edges fill factor (not much connections)
python main.py random --fill 0.2 15
- Any vertex connected with all other vertices (fill = 1)
python main.py random --fill 1 15
- Customize weights random generator (sets randint(1000, 2000))
python main.py random --weights 1000 2000 10
- Basic example, will be shown passed graph with 5 vertices
python main.py matrix 5
- Apply blue color to random graph
python main.py --color 0 0 255 random 10
- Apply 3px line width to random graph
python main.py --width 3 random 10
- Resizing window
python main.py --screen 900 900 random 25
- Apply 30px vertices radius on random graph
python main.py --vsize 30 random 5
- Complicated options usage (will be generated random graph with 10 vertices and displaying with blue color and line width 2px)
python main.py --color 0 0 255 --width 2 random --fill 0.3 10