-
Notifications
You must be signed in to change notification settings - Fork 97
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
Prufer coding for trees #206
Conversation
Codecov Report
@@ Coverage Diff @@
## master #206 +/- ##
==========================================
+ Coverage 97.40% 97.42% +0.02%
==========================================
Files 109 113 +4
Lines 6470 6531 +61
==========================================
+ Hits 6302 6363 +61
Misses 168 168 |
Hi, I already added a few comments so far - I will add more later, but I need to figure out how these Prüfer sequences work first. |
Co-authored-by: Simon Schölly <[email protected]>
Co-authored-by: Simon Schölly <[email protected]>
Co-authored-by: Simon Schölly <[email protected]>
Co-authored-by: Simon Schölly <[email protected]>
A few more minor things (and one major) - appart from that I haven't worked with the documentation for a long time, so I have not found out what is wrong here, maybe @gdalle knows more about that, otherwise I will try too look at it in the next fews days. |
Hi, I adapted to all your remarks. Importantly, I also added the Edit: I also corrected the docs, you were right about the space after |
Co-authored-by: Simon Schölly <[email protected]>
I fixed a small bug (must specify |
The documentation is also working now, right? Then it does indeed seem ready to be merged. |
Yes, the doc is properly working! |
Great, thank you - for your next PR, the tests should also run automatically, its just for someones first PR, that we have to to trigger the tests automatically |
In the near future (~2 months) I'll add more random tree generators, possibly:
Thanks Simon for the support ! |
That are definitely welcome additions. When taking inspiration from existing code for random graphs here, you just have to be a bit careful, that code sometimes quite old and buggy, and might not even calculate the expected distribution (If I remember correctly, for |
What is this potential bias in |
I don't know where exactly the error is, but lets look at an example, the 2-regular graphs on 6-vertices, assuming that the vertices are labeled: There 60 connected graphs (a single cycle) given by Therefore the probability of getting a connected graph should be We can also estimate this probability by sampling repeatedly with julia> using Graphs
julia> p_connected(n) = count(is_connected(random_regular_graph(6, 2)) for _ in 1:n) / n
p_connected (generic function with 1 method)
julia> p_connected(10^6)
0.6911 so there is something off with that algorithm And it can also not be for the (probably much more difficult) problem of random regular graphs on unlabeled vertices, because then the probability would be |
Hi,
I added elementary functionalities related to trees. There are 3 exported functions,
is_tree
checks if a simple graph is a treeprufer_encode
creates the Prüfer sequence associated to a treeprufer_decode
creates the tree associated with a Prüfer sequenceThis is my first PR; I did my best at following the style guide and provide a doc, please do not hesitate to explain how things should be done.
I also modified the
docs
but I did not succeed in having it correctly deployed locally; I get a newtrees
pages but none of the docstrings I wrote seem to be parsed by the Documenter. I also get the following possibly related warning:Related:
https://github.com/JuliaGraphs/Graphs.jl/pull/194
. I'll add a random Cayley tree generator very soon.