#20155: Graph Generators: Add Turan Graph
-------------------------------------+-------------------------------------
Reporter: mcognetta | Owner:
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-7.1
Component: graph theory | Resolution:
Keywords: graphs | Merged in:
Authors: Marco Cognetta | Reviewers: David Coudert
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/mcognetta/graph_generators__add_turan_graph|
bc23a2091ddeb9e0e6d2029e7606d51f4a11bafd
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by mcognetta):
Replying to [comment:7 dcoudert]:
> Hello,
>
> I saw that you have opened a new ticket for the method to compute the
position of vertices of complete multi-partite graphs.
>
> I have some comments on this ticket:
> * remove the empty line between 'def' and 'r"""'
> * You could use some latex in the method description: {{{`(n mod r)`
subsets of size floor`(n/r)` and `r - (n mod r)` subsets of size
ceil`(n/r)`}}} -> {{{`(n mod r)` subsets of size `\floor{n/r}` and `r - (n
mod r)` subsets of size `\ceil{n/r}`}}}
> * use `g.size()`instead of `len(g.edges())`
> * You can combine the tests.
> {{{
> if n<1 or n<r or r<1:
> raise ValueError("Input parameters must satisfy '1 < r < n'.")
> }}}
> * TESTS -> TEST
> * instead of `floor(...)` you should use
`[n//r]*(r-n%r)+[n//r+1]*(n%r)`. This is safe in Python.
> * you can remove `import math`
> * move the `from ... import...` after the ifs. No need to import when
the parameters are wrong (ok, minor improvement)
> * You don't need the `vertex_set = []` statement.
> * I'm not sure if the statement `'Turan Graph with n: %d, r: %d'%(n,r)`
is compatible with Python 3. This should be better `'Turan Graph with n:
{}, r: {}'.format(n,r)`
>
> David.
Thanks for the advice. I updated the code to reflect your suggestions.
--
Ticket URL: <http://trac.sagemath.org/ticket/20155#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.