Skip to content

Commit aadd3e1

Browse files
committed
Add VertexLabeling and matplotlib dependency
1 parent 5480cd9 commit aadd3e1

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

pymathics/graph/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class _NetworkXBuiltin(Builtin):
152152
"EdgeStyle": "{}",
153153
"EdgeWeight": "{}",
154154
"PlotTheme": "{}",
155+
"VertexLabeling": "False",
155156
}
156157

157158
messages = {
@@ -743,6 +744,7 @@ class GraphAtom(AtomBuiltin):
743744
options = {
744745
"VertexSize": "{}",
745746
"VertexStyle": "{}",
747+
"VertexLabeling": "False",
746748
"EdgeStyle": "{}",
747749
"DirectedEdges": "True",
748750
"PlotTheme": "Null",

pymathics/graph/graph_generators.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def apply(self, r, h, expression, evaluation, options):
4343

4444

4545
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("tree")
46+
options["VertexLabeling"] = options["System`VertexLabeling"]
4647
g = Graph(G, options=options)
4748
g.r = r
4849
g.h = h
@@ -83,6 +84,7 @@ def apply(self, m1, m2, expression, evaluation, options):
8384
G = nx.barbell_graph(py_m1, py_m2)
8485

8586
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("spring")
87+
options["VertexLabeling"] = options["System`VertexLabeling"]
8688
g = Graph(G, options=options)
8789
g.m1 = m1
8890
g.m2 = m2
@@ -124,6 +126,7 @@ def apply(self, n, expression, evaluation, options):
124126
G = nx.binomial_tree(py_n)
125127

126128
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("tree")
129+
options["VertexLabeling"] = options["System`VertexLabeling"]
127130
g = Graph(G, options=options)
128131
g.n = n
129132
G.root = g.root = 0
@@ -160,6 +163,7 @@ def apply(self, n, expression, evaluation, options):
160163
G = nx.complete_graph(py_n)
161164

162165
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("circular")
166+
options["VertexLabeling"] = options["System`VertexLabeling"]
163167
g = Graph(G, options=options)
164168
g.n = n
165169
return g
@@ -208,6 +212,7 @@ def apply(self, r, n, expression, evaluation, options):
208212
G = nx.full_rary_tree(py_r, py_n)
209213

210214
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("tree")
215+
options["VertexLabeling"] = options["System`VertexLabeling"]
211216
g = Graph(G, options=options)
212217
g.r = r
213218
g.n = n
@@ -271,6 +276,7 @@ def apply(self, n, expression, evaluation, options):
271276
G = nx.random_tree(py_n)
272277

273278
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("tree")
279+
options["VertexLabeling"] = options["System`VertexLabeling"]
274280
g = Graph(G, options=options)
275281
g.n = n
276282
G.root = g.root = 0
@@ -303,6 +309,7 @@ def apply(self, n, expression, evaluation, options):
303309
G = nx.star_graph(py_n)
304310

305311
options["PlotTheme"] = options["System`PlotTheme"].get_string_value() or String("spring")
312+
options["VertexLabeling"] = options["System`VertexLabeling"]
306313

307314
g = Graph(G, options=options)
308315
g.n = n

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
name="pymathics-graph",
2121
version=__version__,
2222
packages=find_namespace_packages(include=["pymathics.*"]),
23-
install_requires=["Mathics3>=1.1.0", "networkx", "pydot"],
23+
install_requires=["Mathics3>=1.1.0", "networkx", "pydot", "matplotlib"],
2424
# don't pack Mathics in egg because of media files, etc.
2525
zip_safe=False,
2626
maintainer="Mathics Group",

0 commit comments

Comments
 (0)