Skip to content

Commit 7e0fc9b

Browse files
authored
another round of small fixes (#20)
* another round of small fixes * remove extra line
1 parent 4901b0a commit 7e0fc9b

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

pymathics/graph/base.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66

77
# uses networkx
88

9-
import base64
10-
import tempfile
11-
129
from collections import defaultdict
1310
from inspect import isgenerator
14-
from typing import Callable, Optional, Tuple
11+
from typing import Callable, Optional
1512

1613
from mathics.builtin.base import AtomBuiltin, Builtin
1714
from mathics.core.atoms import Atom, Integer, Integer0, Integer1, Integer2, String
1815
from mathics.core.convert.expression import ListExpression, from_python
19-
from mathics.core.element import BaseElement, BoxElementMixin
16+
from mathics.core.element import BaseElement
2017
from mathics.core.expression import Expression
2118
from mathics.core.symbols import Symbol, SymbolList, SymbolTrue
2219
from mathics.core.systemsymbols import (
@@ -879,7 +876,7 @@ class DirectedEdge(Builtin):
879876
:Directed edge:
880877
https://en.wikipedia.org/wiki/Directed_graph</url> (<url>
881878
:NetworkX:
882-
https://networkx.org/documentation/stable/reference/classes/digraph.html</url>,
879+
https://networkx.org/documentation/networkx-2.8.8/reference/classes/digraph.html</url>,
883880
<url>
884881
:WMA:
885882
https://reference.wolfram.com/language/ref/DirectedEdge.html</url>)
@@ -900,7 +897,7 @@ class EdgeConnectivity(_NetworkXBuiltin):
900897
:Edge connectivity:
901898
https://en.wikipedia.org/wiki/Directed_graph</url> (<url>
902899
:NetworkX:
903-
https://networkx.org/documentation/stable/reference/algorithms/\
900+
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
904901
generated/networkx.algorithms.connectivity.connectivity.edge_connectivity.html</url>,
905902
<url>
906903
:WMA:
@@ -1082,9 +1079,15 @@ def eval_s_t(self, graph, s, t, expression, evaluation, options):
10821079

10831080
class FindVertexCut(_NetworkXBuiltin):
10841081
"""
1082+
<url>:Minimum cut:https://en.wikipedia.org/wiki/Minimum_cut</url>\
1083+
(<url>
1084+
:NetworkX:
1085+
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
1086+
generated/networkx.algorithms.connectivity.cuts.minimum_node_cut.html
1087+
</url>, \
10851088
<url>
10861089
:WMA:
1087-
https://reference.wolfram.com/language/ref/FindVertexCut.html</url>
1090+
https://reference.wolfram.com/language/ref/FindVertexCut.html</url>)
10881091
10891092
<dl>
10901093
<dt>'FindVertexCut[$g$]'

pymathics/graph/centralities.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class BetweennessCentrality(_Centrality):
7272
https://en.wikipedia.org/wiki/Betweenness_centrality</url> (<url>
7373
:NetworkX:
7474
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/\
75-
networkx.algorithms.centrality.betweenness_centrality.html</url>,
75+
networkx.algorithms.centrality.betweenness_centrality.html</url>,\
7676
<url>
7777
:WMA:
7878
https://reference.wolfram.com/language/ref/BetweennessCentrality.html</url>)
@@ -116,7 +116,7 @@ class ClosenessCentrality(_Centrality):
116116
https://en.wikipedia.org/wiki/Closeness_centrality</url> (<url>
117117
:NetworkX:
118118
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/\
119-
networkx.algorithms.centrality.closeness_centrality.html</url>,
119+
networkx.algorithms.centrality.closeness_centrality.html</url>,\
120120
<url>
121121
:WMA:
122122
https://reference.wolfram.com/language/ref/ClosenessCentrality.html</url>)
@@ -164,7 +164,7 @@ class DegreeCentrality(_Centrality):
164164
https://en.wikipedia.org/wiki/Degree_centrality</url> (<url>
165165
:NetworkX:
166166
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/\
167-
networkx.algorithms.centrality.degree_centrality.html</url>,
167+
networkx.algorithms.centrality.degree_centrality.html</url>,\
168168
<url>
169169
:WMA:
170170
https://reference.wolfram.com/language/ref/DegreeCentrality.html</url>)
@@ -222,7 +222,7 @@ class EigenvectorCentrality(_ComponentwiseCentrality):
222222
https://en.wikipedia.org/wiki/Eigenvector_centrality</url> (<url>
223223
:NetworkX:
224224
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms\
225-
/generated/networkx.algorithms.centrality.eigenvector_centrality.html</url>,
225+
/generated/networkx.algorithms.centrality.eigenvector_centrality.html</url>,\
226226
<url>
227227
:WMA:
228228
https://reference.wolfram.com/language/ref/EgenvectorCentrality.html</url>)
@@ -284,7 +284,8 @@ class HITSCentrality(_Centrality):
284284
<url>
285285
:NetworkX:
286286
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
287-
generated/networkx.algorithms.link_analysis.hits_alg.hits.html</url>, <url>
287+
generated/networkx.algorithms.link_analysis.hits_alg.hits.html</url>, \
288+
<url>
288289
:WMA:
289290
https://reference.wolfram.com/language/ref/HITSCentrality.html</url>
290291
@@ -326,7 +327,8 @@ class KatzCentrality(_ComponentwiseCentrality):
326327
:NetworkX:
327328
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms\
328329
/generated/networkx.algorithms.centrality.katz_centrality.html\
329-
#networkx.algorithms.centrality.katz_centrality</url>, <url>
330+
#networkx.algorithms.centrality.katz_centrality</url>, \
331+
<url>
330332
:WMA:
331333
https://reference.wolfram.com/language/ref/KatzCentrality.html</url>)
332334
@@ -341,8 +343,6 @@ class KatzCentrality(_ComponentwiseCentrality):
341343
342344
>> g = Graph[{a -> b, b -> c, c -> d, d -> e, e -> c, e -> a}]
343345
= -Graph-
344-
>> g
345-
= -Graph-
346346
>> KatzCentrality[g, 0.2]
347347
= {1.25202, 1.2504, 1.5021, 1.30042, 1.26008}
348348
@@ -387,7 +387,7 @@ class PageRankCentrality(_Centrality):
387387
https://en.wikipedia.org/wiki/Pagerank</url> (<url>
388388
:NetworkX:
389389
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms\
390-
/generated/networkx.algorithms.link_analysis.pagerank_alg.pagerank.html</url>,
390+
/generated/networkx.algorithms.link_analysis.pagerank_alg.pagerank.html</url>,\
391391
<url>
392392
:WMA:
393393
https://reference.wolfram.com/language/ref/PageRankCentrality.html</url>)
@@ -401,9 +401,9 @@ class PageRankCentrality(_Centrality):
401401
vertices in the graph $g$ and weight $alpha$ and initial centralities $beta$.
402402
</dl>
403403
404-
# Not working, possibly because an issue in networkx
404+
## Not working, possibly because an issue in networkx
405405
406-
# >> g = Graph[{a -> d, b -> c, d -> c, d -> a, e -> c, d -> c}]; PageRankCentrality[g, 0.2]
406+
## >> g = Graph[{a -> d, b -> c, d -> c, d -> a, e -> c, d -> c}]; PageRankCentrality[g, 0.2]
407407
= {0.184502, 0.207565, 0.170664, 0.266605, 0.170664}
408408
"""
409409

pymathics/graph/operations.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818

1919
class FindSpanningTree(_NetworkXBuiltin):
2020
"""
21-
<url>:Spanning Tree:https://en.wikipedia.org/wiki/Spanning_tree</url>
22-
(<url>:WMA:
21+
<url>:Spanning Tree:https://en.wikipedia.org/wiki/Spanning_tree</url> \
22+
(<url>:NetworkX:
23+
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
24+
generated/networkx.algorithms.tree.mst.minimum_spanning_edges.html
25+
</url>,\
26+
<url>:WMA:
2327
https://reference.wolfram.com/language/ref/FindSpanningTree.html
2428
</url>)
2529

pymathics/graph/parametric.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,17 @@ def eval(
198198

199199
class CompleteGraph(_NetworkXBuiltin):
200200
"""
201+
<url>Complete Multipartite Graph:
202+
https://en.wikipedia.org/wiki/Multipartite_graph
203+
</url>\
204+
(<url>
205+
:NetworkX:
206+
https://networkx.org/documentation/networkx-2.8.8/reference/\
207+
generated/networkx.generators.classic.complete_multipartite_graph.html
208+
</url>, \
201209
<url>
202210
:WMA:https://reference.wolfram.com/language/ref/CompleteGraph.html
203-
</url>
211+
</url>)
204212
<dl>
205213
<dt>'CompleteGraph[$n$]'
206214
<dd>Returns the complete graph with $n$ vertices, $K_n$.

0 commit comments

Comments
 (0)