2222from mathics .core .symbols import Symbol , SymbolFalse , SymbolTrue
2323from mathics .core .systemsymbols import (
2424 SymbolBlank ,
25+ SymbolFailed ,
2526 SymbolGraphics ,
2627 SymbolMakeBoxes ,
2728 SymbolMissing ,
@@ -910,7 +911,7 @@ def apply(self, graph, item, name, evaluation):
910911 "PropertyValue[{graph_Graph, item_}, name_Symbol]"
911912 value = graph .get_property (item , name .get_name ())
912913 if value is None :
913- return Symbol ( "$Failed" )
914+ return SymbolFailed
914915 return value
915916
916917
@@ -1688,8 +1689,8 @@ def apply(self, graph, expression, evaluation, options):
16881689
16891690class DegreeCentrality (_Centrality ):
16901691 """
1691- >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; Sort[ DegreeCentrality[g] ]
1692- = {2, 2, 3, 4, 5 }
1692+ >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; DegreeCentrality[g]
1693+ = {2, 4, 5, 3, 2 }
16931694
16941695 >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; DegreeCentrality[g, "In"]
16951696 = {1, 3, 3, 0, 1}
@@ -1701,7 +1702,7 @@ class DegreeCentrality(_Centrality):
17011702 def _from_dict (self , graph , centrality ):
17021703 s = len (graph .G ) - 1 # undo networkx's normalization
17031704 return ListExpression (
1704- * [Integer (s * centrality .get (v , 0 )) for v in graph .vertices ],
1705+ * [Integer (s * centrality .get (v , 0 )) for v in graph .vertices . expressions ],
17051706 )
17061707
17071708 def apply (self , graph , expression , evaluation , options ):
0 commit comments