@@ -2249,7 +2249,7 @@ def eccentricity(self, v=None, by_weight=False, algorithm=None,
2249
2249
if with_labels :
2250
2250
return dict (zip (v , eccentricity (self , algorithm = algo , vertex_list = v )))
2251
2251
else :
2252
- return eccentricity (self , algorithm = algo )
2252
+ return eccentricity (self , algorithm = algo , vertex_list = v )
2253
2253
2254
2254
if algorithm in ['Floyd-Warshall-Python' , 'Floyd-Warshall-Cython' , 'Johnson_Boost' ]:
2255
2255
dist_dict = self .shortest_path_all_pairs (by_weight = by_weight , algorithm = algorithm ,
@@ -2343,11 +2343,17 @@ def radius(self, by_weight=False, algorithm=None, weight_function=None,
2343
2343
Traceback (most recent call last):
2344
2344
...
2345
2345
ValueError: radius is not defined for the empty DiGraph
2346
+
2347
+ Check that :trac:`35300` is fixed::
2348
+
2349
+ sage: H = DiGraph([[42, 'John'], [(42, 'John')]])
2350
+ sage: H.radius()
2351
+ 1
2346
2352
"""
2347
2353
if not self .order ():
2348
2354
raise ValueError ("radius is not defined for the empty DiGraph" )
2349
2355
2350
- return min (self .eccentricity (v = None , by_weight = by_weight ,
2356
+ return min (self .eccentricity (v = list ( self ) , by_weight = by_weight ,
2351
2357
weight_function = weight_function ,
2352
2358
check_weight = check_weight ,
2353
2359
algorithm = algorithm ))
@@ -2476,6 +2482,15 @@ def diameter(self, by_weight=False, algorithm=None, weight_function=None,
2476
2482
3
2477
2483
sage: G.diameter(algorithm='DiFUB', by_weight=True)
2478
2484
3.0
2485
+
2486
+ Check that :trac:`35300` is fixed::
2487
+
2488
+ sage: H = DiGraph([[42, 'John'], [(42, 'John')]])
2489
+ sage: H.diameter()
2490
+ +Infinity
2491
+ sage: H.add_edge('John', 42)
2492
+ sage: H.diameter()
2493
+ 1
2479
2494
"""
2480
2495
if not self .order ():
2481
2496
raise ValueError ("diameter is not defined for the empty DiGraph" )
@@ -2507,7 +2522,7 @@ def diameter(self, by_weight=False, algorithm=None, weight_function=None,
2507
2522
from sage .graphs .distances_all_pairs import diameter
2508
2523
return diameter (self , algorithm = 'standard' )
2509
2524
2510
- return max (self .eccentricity (v = None , by_weight = by_weight ,
2525
+ return max (self .eccentricity (v = list ( self ) , by_weight = by_weight ,
2511
2526
weight_function = weight_function ,
2512
2527
check_weight = False ,
2513
2528
algorithm = algorithm ))
0 commit comments