#15669: Errors with graph complement
-------------------------------------+-------------------------------------
       Reporter:  tscrim             |        Owner:  tscrim
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.1
      Component:  graph theory       |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Travis Scrimshaw   |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  public/graphs/complement-15699     |  e2a498c3c7adc71adcadd76b0bc09ea9a6efe77c
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by {'newvalue': u'Travis Scrimshaw', 'oldvalue': ''}):

 * status:  new => needs_review
 * commit:   => e2a498c3c7adc71adcadd76b0bc09ea9a6efe77c
 * branch:   => public/graphs/complement-15699
 * author:   => Travis Scrimshaw


Old description:

> We can't take the complement of an immutable graph:
> {{{
> sage: Gamma = graphs.PathGraph(5).copy(immutable=True)
> sage: Gamma.complement()
> NotImplementedError
> }}}
> which is because `copy(Gamma)` doesn't return a mutable copy.
>
> They are plotting their original graph.
> {{{
> sage: G = graphs.PathGraph(5)
> sage: G.plot()
> sage: GC = G.complement()
> sage: GC.plot() # Same as G.plot()
> }}}

New description:

 We can't take the complement of an immutable graph:
 {{{
 sage: Gamma = graphs.PathGraph(5).copy(immutable=True)
 sage: Gamma.complement()
 NotImplementedError
 }}}
 which is because `copy(Gamma)` doesn't return a mutable copy.

--

Comment:

 Replying to [comment:1 ncohen]:
 > Well, I guess you can fix this one yourself ! You should just add a
 `immutable=True` to the call of `copy` in this method.

 Done and NR. Although making an immutable copy destroys the name of the
 graph, so a slightly different question is do we want that behavior.

 > Besides, your second example of code is not really a bug. `GC` is what
 it should be, but if you plot the complement of a graph with the same
 layout as for the original graph, it so happens that the edges are all
 horizontal too. You can add a `layout="spring"` to `plot()` to emphasize
 it.

 Ah, I see. I also understand why you want to keep the same layout as the
 original graph too.

 Thanks,[[BR]]
 Travis
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=5b42e196c7ad877732d84090c4c59c4d878f1888
 5b42e19]||{{{Fixed complement for immutable graphs.}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=e2a498c3c7adc71adcadd76b0bc09ea9a6efe77c
 e2a498c]||{{{Fixed doctest output.}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/15669#comment:2>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to