#26803 closed defect (fixed)

Error message in szeged_index()

Reported by: jmantysalo Owned by:
Priority: major Milestone: sage-8.5
Component: graph theory Keywords:
Cc: Merged in:
Authors: David Coudert Reviewers: Jori Mäntysalo
Report Upstream: N/A Work issues:
Branch: 9e3a4d8 (Commits) Commit: 9e3a4d820c033cc598521579bbed5261f45407ef
Dependencies: Stopgaps:

Description

Graph({0: [1], 2: []}).szeged_index() gives KeyError: 2. No idea about what is Szeged index, but anyways at least the error message should be better.

Change History (6)

comment:1 Changed 10 months ago by dcoudert

  • Authors set to David Coudert
  • Branch set to public/26803_fix_szeged_index
  • Commit set to da3b48f209e6da3df7fdb96ef8a670f0de2d0aa1
  • Status changed from new to needs_review

According to https://en.wikipedia.org/wiki/Szeged_index, this index is defined for connected graphs only.

I added a test and a doctest, a link to the wikipedia page for easier access to definition, and took the opportunity to do PEP8 cleaning of this method.


New commits:

b714528trac #26803: fix and clean
da3b48ftrac #26803: add wikipedia link

comment:2 Changed 10 months ago by jmantysalo

  • Reviewers set to Jori Mäntysalo
  • Status changed from needs_review to needs_work

Seems good, but test for a ticket should go to TESTS:: section instead of EXAMPLES::.

comment:3 Changed 10 months ago by git

  • Commit changed from da3b48f209e6da3df7fdb96ef8a670f0de2d0aa1 to 9e3a4d820c033cc598521579bbed5261f45407ef

Branch pushed to git repo; I updated commit sha1. New commits:

9e3a4d8trac #26803: add TESTS block

comment:4 Changed 10 months ago by dcoudert

  • Status changed from needs_work to needs_review

Right, done.

comment:5 Changed 10 months ago by jmantysalo

  • Status changed from needs_review to positive_review

Good to go.

comment:6 Changed 10 months ago by vbraun

  • Branch changed from public/26803_fix_szeged_index to 9e3a4d820c033cc598521579bbed5261f45407ef
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.