diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c8cdb0d..fb6f057 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -23,10 +23,10 @@ jobs: python -m pip install --upgrade pip python -m pip install pytest # Can comment out when next Mathics core and Mathics-scanner are released - # python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full] + python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full] python -m pip install -e git+https://github.com/Mathics3/mathics-core#egg=Mathics3[full] python -m pip install -e . - # (cd src/mathics3 && bash ./admin-tools/make-op-tables.sh) + (cd src/mathics3 && bash ./admin-tools/make-op-tables.sh) - name: install pymathics graph run: | make develop diff --git a/pymathics/graph/base.py b/pymathics/graph/base.py index 59e7daa..211532d 100644 --- a/pymathics/graph/base.py +++ b/pymathics/graph/base.py @@ -10,6 +10,11 @@ from inspect import isgenerator from typing import Callable, Optional, Union +from mathics.builtin.no_meaning import ( + DirectedEdge as GenericDirectedEdge, + UndirectedEdge as GenericUndirectedEdge, +) +from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED from mathics.core.builtin import AtomBuiltin, Builtin from mathics.core.atoms import Atom, Integer, Integer0, Integer1, Integer2, String from mathics.core.convert.expression import ListExpression, from_python, to_mathics_list @@ -893,8 +898,8 @@ def neighbors(v): return self._retrieve(graph, what, neighbors, expression, evaluation) -class DirectedEdge(Builtin): - """ +class DirectedEdge(GenericDirectedEdge): + r""" Edge of a :Directed graph: https://en.wikipedia.org/wiki/Directed_graph ( @@ -908,9 +913,15 @@ class DirectedEdge(Builtin):
'DirectedEdge[$u$, $v$]'
create a directed edge from $u$ to $v$. + + >> DirectedEdge[x, y, z] + = x → y → z + + >> a \[DirectedEdge] b + = a → b """ - summary_text = "make a directed graph edge" + attributes = A_PROTECTED | A_READ_PROTECTED class EdgeConnectivity(_NetworkXBuiltin): @@ -1494,7 +1505,7 @@ def _items(self, graph): return graph.vertices -class UndirectedEdge(Builtin): +class UndirectedEdge(GenericUndirectedEdge): """ :WMA link: @@ -1506,17 +1517,10 @@ class UndirectedEdge(Builtin): >> a <-> b - = UndirectedEdge[a, b] - - >> (a <-> b) <-> c - = UndirectedEdge[UndirectedEdge[a, b], c] - - >> a <-> (b <-> c) - = UndirectedEdge[a, UndirectedEdge[b, c]] + = ... """ - summary_text = "undirected graph edge" - pass + attributes = A_PROTECTED | A_READ_PROTECTED # class EdgeAdd(_NetworkXBuiltin):