-
Notifications
You must be signed in to change notification settings - Fork 92
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
human-readable output for simple graphs #148
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #148 +/- ##
==========================================
+ Coverage 97.54% 98.04% +0.49%
==========================================
Files 109 109
Lines 6314 5779 -535
==========================================
- Hits 6159 5666 -493
+ Misses 155 113 -42 |
I am not sure if I like this. For small graph it makes sense, but for larger graphs like your last example, I feel like it adds too much noise, without providing much information to the user. I wonder if a small adjacency matrix with some unicode characters would be more useful? Another point, if we are going for printing the whole graph, maybe we can use do-syntax instead of |
Something like |
I tried a circle plot, not sure if this is better, even for small graphs (it looks better by copy-pasting it in the REPL). julia> plot(stdout, erdos_renyi(5, 0.5))
{5, 6} undirected simple Int64 graph
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠴1⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡠⠒⠁⠀⠀⢱⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⠔⠉⠀⠀⠀⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢀⡤⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀5⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⢀⠴2⠀
⠀⠘⡄⠈⠓⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⢇⠀⢀⡠⠚⠁⢠⠃⠀
⠀⠀⢸⠀⠀⠀⠉⠒⣄⠀⠀⠀⠀⠀⠀⣸⡖⠉⠀⠀⠀⡇⠀⠀
⠀⠀⠀⢇⠀⠀⠀⠀⠀⠙⠤⣀⣀⠴⠉⠀⢱⠀⠀⠀⡸⠀⠀⠀
⠀⠀⠀⠸⡀⠀⠀⠀⠀⢀⡤⠚⠓⢤⡀⠀⠀⢇⠀⢀⠇⠀⠀⠀
⠀⠀⠀⠀⢱⠀⠀⡠⠖⠁⠀⠀⠀⠀⠈⠲⢄⠘⡄⡎⠀⠀⠀⠀
⠀⠀⠀⠀⠈4⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙3⠁⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
julia> plot(stdout, erdos_renyi(7, 0.5))
{7, 14} undirected simple Int64 graph
⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⢶1⢷⠦⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⡠⠔⠚⠁⡔⠁⠀⠀⠑⡄⠈⠓⠤⢄⡀⠀⠀⠀⠀
⠀⠀⠀7⡿⡒⠒⢲⠚⠒⠒⠒⠒⠒⠚⢳⡒⠒⠒⠛2⠀⠀⠀
⠀⠀⠀⠀⠑⢌⡕⠓⠤⡀⠀⠀⠀⠀⠀⠀⠘⢄⠀⠀⡇⡇⠀⠀
⠀⠀⠀⠀⢠⠊⠢⡀⠀⠈⠑⠒⠤⡀⠀⠀⠀⠀⠣⣼⠀⢸⡀⠀
⠀⠀⠀⡔⠁⠀⠀⠑⢆⠀⠀⠀⠀⠈⠑⠒⠤⡀⠀⡞⢢⠀⢇⠀
⠀⣠⠊⠀⠀⠀⠀⠀⠈⠲⡀⠀⠀⠀⠀⠀⠀⠈⢱⠓⠤⡑⣼⡀
6⣷⢖⡒⠒⠒⠒⠒⠒⠒⠛⢖⠒⠒⠒⠒⠒⠒⡞⠒⠒⠚⣻3
⠀⠀⠓⡌⠑⠢⢤⡀⠀⠀⠀⠈⠱⡀⠀⠀⠀⢰⠁⠀⢠⠚⠀⠀
⠀⠀⠀⠘⢢⡀⠀⠈⠑⠒⢤⣀⠀⠈⢆⠀⠀⡜⢀⡔⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠘⢄⠀⠀⠀⠀⠀⠉⠒⠢⣱⣤⡣⠃⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀5⠉⠉⠉⠉⠉⠉⠉⠉4⠀⠀⠀⠀⠀⠀⠀
julia> plot(stdout, erdos_renyi(10, 0.5))
{10, 19} undirected simple Int64 graph
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⠒⠶⠶⣒⡒⢲⢻⠒⠳⡖⠒⠒⠒⢢⠀⠀⠀⠀⠀
⠀⠀⢀⡰⠁⠀⠀⠀⠀⢈⡟⢺⠢⠤⣘⣄⠀⠀⢸⠀⠀⠀⠀⠀
⠀⢠⠎⠀⠀⠀⠀⠀⠀⡸⠀⢸⠀⠀⠀⠈⠫⡑⢺⠤⣀⣀⠀⠀
⠀⠹⡶⡢⢤⣀⠀⠀⢠⠃⠀⢸⠀⠀⠀⠀⠀⠑⣼⡤⢔⢶⣷⠀
⠀⠀⠘⢬⠓⢄⡉⠑⡞⠤⢄⣸⣀⡠⠤⠒⠊⢉⣸⢺⡥⢣⢻⠀
⠀⠀⠀⠀⢣⡀⣉⣲⣥⠒⠊⢹⠉⠑⠒⣤⢖⣉⢸⠚⠓⡇⢸⠀
⠀⣀⣤⣔⣚⣙⣄⣇⣀⣙⣤⣸⣀⣴⣉⣀⣀⣰⣻⣓⣺⣼⣾⠀
⠀⠘⢆⠀⠀⠀⡜⢆⡀⢀⡤⢺⠓⢤⡀⢀⠞⠀⢸⢀⠇⡰⠃⠀
⠀⠀⠈⠲⡀⢰⠁⡠⠷⡁⠀⢸⠀⠀⡸⠺⢄⠀⢸⣎⠖⠁⠀⠀
⠀⠀⠀⠀⠙⠾⣋⣀⠀⠉⢆⢸⢀⠎⠁⠀⠀⠙⠺⠋⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠉⠒⠚⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
julia> plot(stdout, erdos_renyi(20, 0.5))
{20, 95} undirected simple Int64 graph
⠀⠀⠀⠀⠀⠀⢀⣠⣤⣶⢶⣷⣯⣶⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⣿⣿⡿⣿⣟⠶⣿⣿⣿⣿⢾⢶⣦⠀⠀⠀⠀⠀
⠀⠀⢠⣴⣿⣿⣿⣷⣷⣿⢷⡽⣿⣿⣿⢿⣷⣿⣯⣦⣤⡀⠀⠀
⠀⢠⣾⣿⣿⣿⡮⢿⣿⡭⢟⣿⡻⣛⣽⣿⣿⣬⣿⣟⣻⣺⣆⠀
⢠⣿⣿⣾⣿⣿⡿⡽⣿⣠⠛⣼⢟⣷⣿⣽⢎⢽⣅⡬⠶⣻⣿⠀
⣼⣿⣿⣽⢳⣷⣟⣝⣿⣿⣾⣿⣱⣷⢿⢿⠯⣿⢌⣢⡮⢫⠻⡄
⠘⣿⣻⣿⣻⡾⣿⣻⣷⣿⢿⣏⣟⡿⣷⢼⣄⣯⢾⢿⣗⣇⣾⠁
⠀⣿⣿⣿⣿⣽⣶⣷⡟⡹⣭⣽⡿⡏⢏⣻⢿⡲⠫⢷⡾⣿⣏⠀
⠀⠘⢿⣿⣿⢿⣏⣟⣯⡕⢣⢯⣻⣽⣺⣸⣿⣯⠗⣾⣿⣽⠃⠀
⠀⠀⠘⠻⣽⢧⣿⣿⡷⣱⡮⡤⡞⣷⣿⣿⣧⣿⣼⣾⡿⠃⠀⠀
⠀⠀⠀⠀⠙⠾⣿⣿⣿⣿⣯⣭⣯⢯⣿⣿⣿⣿⠷⠋⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠛⠛⠛⠿⠿⠿⠛⠛⠁⠀⠀⠀⠀⠀⠀⠀
|
Fix #139
Should I omit vertices with degree 0 ?