Skip to content

wrong default algorithm for computing the diameter of weighted graphs #40013

@dcoudert

Description

@dcoudert

Steps To Reproduce

sage: G = graphs.PetersenGraph()
sage: G.diameter(by_weight=True)

Expected Behavior

2.0

Actual Behavior

ValueError                                Traceback (most recent call last)
Cell In[2], line 1
----> 1 G.diameter(by_weight=True)

File ~/sage/src/sage/graphs/graph.py:5144, in Graph.diameter(self, by_weight, algorithm, weight_function, check_weight)
   5142 if algorithm in ['standard', '2sweep', 'multi-sweep', 'iFUB']:
   5143     if by_weight:
-> 5144         raise ValueError("algorithm '" + algorithm + "' does not work" +
   5145                          " on weighted graphs")
   5146     from sage.graphs.distances_all_pairs import diameter
   5147     return diameter(self, algorithm=algorithm)

ValueError: algorithm 'iFUB' does not work on weighted graphs

Additional Information

Algorithm 'iFUB' is currently only implemented for unweighted graphs.
The default algorithm should be 'DHV' for weighted graphs and 'iFUB' for unweighted graphs.

Environment

  • OS: all
  • Sage Version: 10.7.beta1

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions