Opened 10 years ago

Closed 10 years ago

#7314 closed enhancement (fixed)

Average distance, Wiener Index, Szeged index

Reported by: ncohen Owned by: rlm
Priority: major Milestone: sage-4.3
Component: graph theory Keywords:
Cc: Merged in: sage-4.3.rc1
Authors: Nathann Cohen Reviewers: Robert Miller
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Hello !!

This patch defines :

  • The average distance between vertices : Graph.average_distance
  • The Szeged Index of a graph : Graph.szeged_index
  • The Wiener Index of a graph : Graph.wiener_index

Everything this patch adds (except the average distance) is documented in : http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6TY9-3VVCHY8-9&_user=10&_rdoc=1&_fmt=&_orig=search&_sort=d&_docanchor=&view=c&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=6d22be39b064af51023439c3bb59c459

This reference is mentioned in the docstrings.

Nathann

Attachments (1)

trac_7314.patch (7.4 KB) - added by ncohen 10 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by ncohen

  • Status changed from new to needs_review

comment:2 Changed 10 years ago by mhansen

In the docstrings, you should not put comments on the sage: line like in

EXAMPLE:: 

    sage: # From [2], cited in [1] 
    sage: g=graphs.PathGraph(10) 
    sage: w=lambda x: (x*(x*x -1)/6) 
    sage: g.wiener_index()==w(10) 
    True 

Instead, it should be

EXAMPLE:

From [2], cited in [1]::

    sage: g=graphs.PathGraph(10) 
    sage: w=lambda x: (x*(x*x -1)/6) 
    sage: g.wiener_index()==w(10) 
    True 

Also, you should see the way that references are handled elsewhere in the Sage library.

comment:3 Changed 10 years ago by ncohen

I hope you will prefer this one ! I had taken as examples other docstrings which you may find badly formatted... This time, I took as an example Minh's code from Cliques functiosn, knowing that never I witnessed Minh making the slightest error :-)

Nathann

Changed 10 years ago by ncohen

comment:4 Changed 10 years ago by rlm

  • Authors set to Nathann Cohen
  • Report Upstream set to N/A
  • Reviewers set to Robert Miller
  • Status changed from needs_review to positive_review

comment:5 Changed 10 years ago by mhansen

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