Opened 8 years ago

Closed 8 years ago

#13813 closed defect (fixed)

Fix bug in chessboard graphs generator

Reported by: dcoudert Owned by: jason, ncohen, rlm
Priority: major Milestone: sage-5.6
Component: graph theory Keywords:
Cc: sluther, ncohen Merged in: sage-5.6.beta0
Authors: David Coudert Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by dcoudert)

We should normally have:

  • The BishopGraph?([d1,d2],radius=r) is isomorphic to the graph obtained merging the edges of the KnightGraphs?([d1,d2],one=i,two=i) for 1<= i <= r.
  • The QueenGraph?([d1,d2],radius=r) is isomorphic to the graph obtained merging the edges of a RookGraph?([d1,d2,radius=r) and a BishopGraph?([d1,d2],radius=r)

With current implementation, the result was sometimes incorrect. This patch solves this issue and adds necessary doctests.

Attachments (1)

trac_13813.patch (3.0 KB) - added by dcoudert 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by dcoudert

comment:1 Changed 8 years ago by dcoudert

  • Cc sluther ncohen added
  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 8 years ago by ncohen

  • Status changed from needs_review to positive_review

I was about to say that you should replace if not B.is_isomorphic(H) by if B != H, but...

sage: %timeit B == H
5 loops, best of 3: 199 ms per loop
sage: %timeit B.is_isomorphic(H)
25 loops, best of 3: 16.3 ms per loop

Honestly ...>_<

Nathann

comment:3 Changed 8 years ago by dcoudert

Thanks.

comment:4 Changed 8 years ago by jdemeyer

  • Reviewers set to Nathann Cohen

comment:5 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.6.beta0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.