human-readable output for simple graphs#148
human-readable output for simple graphs#148etiennedeg wants to merge 1 commit intoJuliaGraphs:masterfrom
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (78.04%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ 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 🚀 New features to boost your workflow:
|
|
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
⠀⠀⠀⠀⠀⠀⢀⣠⣤⣶⢶⣷⣯⣶⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⣿⣿⡿⣿⣟⠶⣿⣿⣿⣿⢾⢶⣦⠀⠀⠀⠀⠀
⠀⠀⢠⣴⣿⣿⣿⣷⣷⣿⢷⡽⣿⣿⣿⢿⣷⣿⣯⣦⣤⡀⠀⠀
⠀⢠⣾⣿⣿⣿⡮⢿⣿⡭⢟⣿⡻⣛⣽⣿⣿⣬⣿⣟⣻⣺⣆⠀
⢠⣿⣿⣾⣿⣿⡿⡽⣿⣠⠛⣼⢟⣷⣿⣽⢎⢽⣅⡬⠶⣻⣿⠀
⣼⣿⣿⣽⢳⣷⣟⣝⣿⣿⣾⣿⣱⣷⢿⢿⠯⣿⢌⣢⡮⢫⠻⡄
⠘⣿⣻⣿⣻⡾⣿⣻⣷⣿⢿⣏⣟⡿⣷⢼⣄⣯⢾⢿⣗⣇⣾⠁
⠀⣿⣿⣿⣿⣽⣶⣷⡟⡹⣭⣽⡿⡏⢏⣻⢿⡲⠫⢷⡾⣿⣏⠀
⠀⠘⢿⣿⣿⢿⣏⣟⣯⡕⢣⢯⣻⣽⣺⣸⣿⣯⠗⣾⣿⣽⠃⠀
⠀⠀⠘⠻⣽⢧⣿⣿⡷⣱⡮⡤⡞⣷⣿⣿⣧⣿⣼⣾⡿⠃⠀⠀
⠀⠀⠀⠀⠙⠾⣿⣿⣿⣿⣯⣭⣯⢯⣿⣿⣿⣿⠷⠋⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠛⠛⠛⠿⠿⠿⠛⠛⠁⠀⠀⠀⠀⠀⠀⠀
|
|
I am working a lot with directed graphs in statistics. For that application for small graphs you really just want a representation If you want you can even create a parsable one line out-put, such that the output is able to recreate the graph if you add a constructor |
|
This has bitrotten in the last few years and it has merge conflicts. I will mark it as a draft for now, to keep my review queue a bit more organized. Do not hesitate to mark it back to not a draft if you would like to tackle it. |
Fix #139
Should I omit vertices with degree 0 ?