From 438c87279c37c06c5ae7623bfb26a053ced0d6e2 Mon Sep 17 00:00:00 2001
From: rocky <rb@dustyfeet.com>
Date: Sun, 31 Jul 2022 17:22:24 -0400
Subject: [PATCH] Get ready for release 5.0.0a0

---
 NEWS.md                     | 9 +++++++++
 admin-tools/pyenv-versions  | 2 +-
 pymathics/graph/__main__.py | 9 +++++----
 pymathics/graph/version.py  | 2 +-
 setup.cfg                   | 2 +-
 setup.py                    | 3 ++-
 6 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index b38c34b..081dfa9 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,12 @@
+5.0.0.alpha0
+------------
+
+Track API changes in Mathics 5.0.0.
+
+Changed to use networkx 2.8 or greater.
+
+Some functionality has been removed for now, because networkx 2.8's API is a bit different with its new NodeView and EdgeView API.
+
 2.3.0
 -----
 
diff --git a/admin-tools/pyenv-versions b/admin-tools/pyenv-versions
index a45a4fc..ecf8b6a 100644
--- a/admin-tools/pyenv-versions
+++ b/admin-tools/pyenv-versions
@@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
     echo "This script should be *sourced* rather than run directly through bash"
     exit 1
 fi
-export PYVERSIONS='3.6.12 3.7.9 3.8.6 3.9.1'
+export PYVERSIONS='3.6.13 3.7.13 3.8.13 3.9.13 3.10.5'
diff --git a/pymathics/graph/__main__.py b/pymathics/graph/__main__.py
index 25490e6..2095bb4 100644
--- a/pymathics/graph/__main__.py
+++ b/pymathics/graph/__main__.py
@@ -22,6 +22,7 @@
 from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue
 from mathics.core.systemsymbols import (
     SymbolBlank,
+    SymbolFailed,
     SymbolGraphics,
     SymbolMakeBoxes,
     SymbolMissing,
@@ -910,7 +911,7 @@ def apply(self, graph, item, name, evaluation):
         "PropertyValue[{graph_Graph, item_}, name_Symbol]"
         value = graph.get_property(item, name.get_name())
         if value is None:
-            return Symbol("$Failed")
+            return SymbolFailed
         return value
 
 
@@ -1688,8 +1689,8 @@ def apply(self, graph, expression, evaluation, options):
 
 class DegreeCentrality(_Centrality):
     """
-    >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; Sort[DegreeCentrality[g]]
-     = {2, 2, 3, 4, 5}
+    >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; DegreeCentrality[g]
+     = {2, 4, 5, 3, 2}
 
     >> g = Graph[{a -> b, b <-> c, d -> c, d -> a, e <-> c, d -> b}]; DegreeCentrality[g, "In"]
      = {1, 3, 3, 0, 1}
@@ -1701,7 +1702,7 @@ class DegreeCentrality(_Centrality):
     def _from_dict(self, graph, centrality):
         s = len(graph.G) - 1  # undo networkx's normalization
         return ListExpression(
-            *[Integer(s * centrality.get(v, 0)) for v in graph.vertices],
+            *[Integer(s * centrality.get(v, 0)) for v in graph.vertices.expressions],
         )
 
     def apply(self, graph, expression, evaluation, options):
diff --git a/pymathics/graph/version.py b/pymathics/graph/version.py
index 848ccdb..769c79e 100644
--- a/pymathics/graph/version.py
+++ b/pymathics/graph/version.py
@@ -5,4 +5,4 @@
 # well as importing into Python. That's why there is no
 # space around "=" below.
 # fmt: off
-__version__="5.0.0.dev0"
+__version__="5.0.0a0"  # noqa
diff --git a/setup.cfg b/setup.cfg
index ca6e317..5fa7d10 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [bdist_wheel]
-universal = 1
+universal = 0
 
 [metadata]
 description_file = README.rst
diff --git a/setup.py b/setup.py
index b84acd7..b675b9b 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ def read(*rnames):
     name="pymathics-graph",
     version=__version__,  # noqa
     packages=find_namespace_packages(include=["pymathics.*"]),
-    install_requires=["Mathics3>=3.0.0", "networkx", "pydot", "matplotlib"],
+    install_requires=["Mathics3>=5.0.0", "networkx>=2.8.0", "pydot", "matplotlib"],
     # don't pack Mathics in egg because of media files, etc.
     zip_safe=False,
     maintainer="Mathics Group",
@@ -48,6 +48,7 @@ def read(*rnames):
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: Scientific/Engineering",