Skip to content

Commit 2681706

Browse files
authored
Merge pull request #25 from Mathics3/doc-link-pass
Another pass over doc links
2 parents 896fe2e + 5b1bba6 commit 2681706

File tree

4 files changed

+68
-77
lines changed

4 files changed

+68
-77
lines changed

pymathics/graph/base.py

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -896,12 +896,11 @@ def neighbors(v):
896896

897897
class DirectedEdge(Builtin):
898898
"""
899-
<url>
900-
:Directed edge:
899+
Edge of a <url>
900+
:Directed graph:
901901
https://en.wikipedia.org/wiki/Directed_graph</url> (<url>
902902
:NetworkX:
903-
https://networkx.org/documentation/networkx-2.8.8/reference/classes/digraph.html</url>,
904-
<url>
903+
https://networkx.org/documentation/networkx-2.8.8/reference/classes/digraph.html</url>, <url>
905904
:WMA:
906905
https://reference.wolfram.com/language/ref/DirectedEdge.html</url>)
907906
@@ -919,11 +918,10 @@ class EdgeConnectivity(_NetworkXBuiltin):
919918
"""
920919
<url>
921920
:Edge connectivity:
922-
https://en.wikipedia.org/wiki/Directed_graph</url> (<url>
921+
https://en.wikipedia.org/wiki/Directed_graph#Directed_graph_connectivity</url> (<url>
923922
:NetworkX:
924923
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/\
925-
generated/networkx.algorithms.connectivity.connectivity.edge_connectivity.html</url>,
926-
<url>
924+
generated/networkx.algorithms.connectivity.connectivity.edge_connectivity.html</url>, <url>
927925
:WMA:
928926
https://reference.wolfram.com/language/ref/EdgeConnectivity.html</url>)
929927
@@ -969,7 +967,7 @@ def eval_st(self, graph, s, t, expression, evaluation, options):
969967
class EdgeIndex(_NetworkXBuiltin):
970968
"""
971969
<url>
972-
:WMA:
970+
:WMA link:
973971
https://reference.wolfram.com/language/ref/EdgeIndex.html</url>
974972
975973
<dl>
@@ -997,7 +995,7 @@ def eval(self, graph, v, expression, evaluation, options):
997995
class EdgeList(_PatternList):
998996
"""
999997
<url>
1000-
:WMA:
998+
:WMA link:
1001999
https://reference.wolfram.com/language/ref/EdgeList.html</url>
10021000
10031001
<dl>
@@ -1015,7 +1013,7 @@ def _items(self, graph):
10151013
class EdgeRules(_NetworkXBuiltin):
10161014
"""
10171015
<url>
1018-
:WMA:
1016+
:WMA link:
10191017
https://reference.wolfram.com/language/ref/EdgeRules.html</url>
10201018
10211019
<dl>
@@ -1047,8 +1045,7 @@ class FindShortestPath(_NetworkXBuiltin):
10471045
https://en.wikipedia.org/wiki/Shortest_path_problem</url> (<url>
10481046
:NetworkX:
10491047
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms\
1050-
/generated/networkx.algorithms.shortest_paths.generic.shortest_path.html</url>,
1051-
<url>
1048+
/generated/networkx.algorithms.shortest_paths.generic.shortest_path.html</url>, <url>
10521049
:WMA:
10531050
https://reference.wolfram.com/language/ref/FindShortestPath.html</url>)
10541051
@@ -1082,7 +1079,7 @@ class FindShortestPath(_NetworkXBuiltin):
10821079
summary_text = "find the shortest path between two vertices"
10831080

10841081
def eval_s_t(self, graph, s, t, expression, evaluation, options):
1085-
"%(name)s[graph_, s_, t_, OptionsPattern[%(name)s]]"
1082+
"FindShortestPath[graph_, s_, t_, OptionsPattern[FindShortestPath]]"
10861083
graph = self._build_graph(graph, evaluation, options, expression)
10871084
if not graph:
10881085
return
@@ -1168,8 +1165,7 @@ def eval_st(self, graph, s, t, expression, evaluation, options):
11681165

11691166
class GraphAtom(AtomBuiltin):
11701167
"""
1171-
<url>:Graph:https://en.wikipedia.org/wiki/graph</url> (
1172-
<url>:WMA:
1168+
<url>:Graph:https://en.wikipedia.org/wiki/graph</url> (<url>:WMA:
11731169
https://reference.wolfram.com/language/ref/Graph.html</url>)
11741170
<dl>
11751171
<dt>'Graph[{$e1, $e2, ...}]'
@@ -1223,7 +1219,7 @@ def eval_1(self, vertices, edges, evaluation, options):
12231219
class HighlightGraph(_NetworkXBuiltin):
12241220
"""
12251221
<url>
1226-
:WMA:
1222+
:WMA link:
12271223
https://reference.wolfram.com/language/ref/HighlightGraph.html</url>
12281224
12291225
<dl>
@@ -1263,7 +1259,7 @@ def parse(item):
12631259
class Property(Builtin):
12641260
"""
12651261
<url>
1266-
:WMA:
1262+
:WMA link:
12671263
https://reference.wolfram.com/language/ref/Property.html</url>
12681264
12691265
<dl>
@@ -1279,7 +1275,7 @@ class Property(Builtin):
12791275
class PropertyValue(Builtin):
12801276
"""
12811277
<url>
1282-
:WMA:
1278+
:WMA link:
12831279
https://reference.wolfram.com/language/ref/PropertyValue.html</url>
12841280
12851281
<dl>
@@ -1322,7 +1318,7 @@ def eval(self, graph, item, name, evaluation):
13221318
class VertexAdd(_NetworkXBuiltin):
13231319
"""
13241320
<url>
1325-
:WMA:
1321+
:WMA link:
13261322
https://reference.wolfram.com/language/ref/VertexAdd.html</url>
13271323
13281324
<dl>
@@ -1342,7 +1338,7 @@ class VertexAdd(_NetworkXBuiltin):
13421338
summary_text = "add a vertex"
13431339

13441340
def eval(self, graph: Expression, what, expression, evaluation, options):
1345-
"%(name)s[graph_, what_, OptionsPattern[%(name)s]]"
1341+
"VertexAdd[graph_, what_, OptionsPattern[VertexAdd]]"
13461342
mathics_graph = self._build_graph(graph, evaluation, options, expression)
13471343
if mathics_graph:
13481344
if what.get_head_name() == "System`List":
@@ -1356,7 +1352,7 @@ def eval(self, graph: Expression, what, expression, evaluation, options):
13561352
class VertexConnectivity(_NetworkXBuiltin):
13571353
"""
13581354
<url>
1359-
:WMA:
1355+
:WMA link:
13601356
https://reference.wolfram.com/language/ref/VertexConnectivity.html</url>
13611357
13621358
<dl>
@@ -1407,7 +1403,7 @@ def eval_st(self, graph, s, t, expression, evaluation, options):
14071403
class VertexDelete(_NetworkXBuiltin):
14081404
"""
14091405
<url>
1410-
:WMA:
1406+
:WMA link:
14111407
https://reference.wolfram.com/language/ref/VertexDelete.html</url>
14121408
14131409
<dl>
@@ -1448,7 +1444,7 @@ def eval(self, graph, what, expression, evaluation, options) -> Optional[Graph]:
14481444
class VertexIndex(_NetworkXBuiltin):
14491445
"""
14501446
<url>
1451-
:WMA:
1447+
:WMA link:
14521448
https://reference.wolfram.com/language/ref/VertexIndex.html</url>
14531449
<dl>
14541450
<dt>'VertexIndex'['g', 'v']
@@ -1476,7 +1472,7 @@ def eval(self, graph, v, expression, evaluation, options):
14761472
class VertexList(_PatternList):
14771473
"""
14781474
<url>
1479-
:WMA:
1475+
:WMA link:
14801476
https://reference.wolfram.com/language/ref/VertexList.html</url>
14811477
<dl>
14821478
<dt>'VertexList[$edgelist$]'
@@ -1503,7 +1499,7 @@ def _items(self, graph):
15031499
class UndirectedEdge(Builtin):
15041500
"""
15051501
<url>
1506-
:WMA:
1502+
:WMA link:
15071503
https://reference.wolfram.com/language/ref/UndirectedEdge.html</url>
15081504
15091505
<dl>
@@ -1543,9 +1539,9 @@ class UndirectedEdge(Builtin):
15431539

15441540
class EdgeDelete(_NetworkXBuiltin):
15451541
"""
1546-
<url>
1542+
Delete an Edge (<url>
15471543
:WMA:
1548-
https://reference.wolfram.com/language/ref/EdgeDelete.html</url>
1544+
https://reference.wolfram.com/language/ref/EdgeDelete.html</url>)
15491545
15501546
<dl>
15511547
<dt>'EdgeDelete'[$g$, $edge$]

pymathics/graph/parametric.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,10 @@ def eval_with_k(
500500
class LadderGraph(_NetworkXBuiltin):
501501
"""
502502
<url>
503-
:Ladder graph:https://en.wikipedia.org/wiki/Ladder_graph
504-
</url>(<url>:NetworkX:
503+
:Ladder graph:https://en.wikipedia.org/wiki/Ladder_graph</url> (<url>
504+
:NetworkX:
505505
https://networkx.org/documentation/networkx-2.8.8/reference\
506-
/generated/networkx.generators.classic.ladder_graph.html
507-
</url>)
506+
/generated/networkx.generators.classic.ladder_graph.html</url>)
508507
509508
<dl>
510509
<dt>'LadderGraph[$n$]'
@@ -544,7 +543,7 @@ class PathGraph(_NetworkXBuiltin):
544543
"""
545544
<url>
546545
:Path graph:https://en.wikipedia.org/wiki/Path_graph
547-
</url>(<url>:WMA:https://reference.wolfram.com/language/ref/PathGraph.html
546+
</url> (<url>:WMA:https://reference.wolfram.com/language/ref/PathGraph.html
548547
</url>)
549548
<dl>
550549
<dt>'PathGraph[{$v_1$, $v_2$, ...}]'
@@ -576,8 +575,10 @@ class RandomTree(_NetworkXBuiltin):
576575
"""
577576
<url>:NetworkX:
578577
https://networkx.org/documentation/networkx-2.8.8/reference\
579-
/generated/networkx.generators.trees.random_tree.html
580-
</url>
578+
/generated/networkx.generators.trees.random_tree.html</url>, <url>
579+
:WMA:
580+
https://reference.wolfram.com/language/ref/RandomTree.html</url>
581+
581582
<dl>
582583
<dt>'RandomTree[$n$]'
583584
<dd>Returns a uniformly random tree on $n$ nodes.
@@ -615,13 +616,11 @@ def eval(
615616
class StarGraph(_NetworkXBuiltin):
616617
"""
617618
<url>
618-
:Path graph:https://en.wikipedia.org/wiki/Star_graph
619-
</url>(
620-
<url>:NetworkX:
619+
:Star graph:https://en.wikipedia.org/wiki/Star_graph
620+
</url>(<url>:NetworkX:
621621
https://networkx.org/documentation/networkx-2.8.8/reference\
622622
/generated/networkx.generators.classic.star_graph.html
623-
</url>,
624-
<url>:WMA:
623+
</url>, <url>:WMA:
625624
https://reference.wolfram.com/language/ref/StarGraph.html
626625
</url>)
627626
<dl>

pymathics/graph/properties.py

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ class ConnectedGraphQ(_NetworkXBuiltin):
7575
:NetworkX:
7676
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms\
7777
/generated/networkx.algorithms.components.is_connected.html
78-
</url>,
79-
<url>
78+
</url>, <url>
8079
:WMA:
8180
https://reference.wolfram.com/language/ref/ConnectedGraphQ.html</url>)
8281
@@ -130,8 +129,7 @@ class DirectedGraphQ(_NetworkXBuiltin):
130129
:NetworkX:
131130
https://networkx.org/documentation/networkx-2.8.8/reference\
132131
/generated/networkx.classes.function.is_directed.html
133-
</url>,
134-
<url>
132+
</url>, <url>
135133
:WMA:
136134
https://reference.wolfram.com/language/ref/DirectedGraphQ.html</url>)
137135
@@ -173,8 +171,7 @@ class LoopFreeGraphQ(_NetworkXBuiltin):
173171
:NetworkX:
174172
https://networkx.org/documentation/networkx-2.8.8/reference/\
175173
generated/networkx.classes.function.nodes_with_selfloops.html
176-
</url>,
177-
<url>
174+
</url>, <url>
178175
:WMA:
179176
https://reference.wolfram.com/language/ref/LoopFreeGraphQ.html</url>)
180177
@@ -211,8 +208,8 @@ class MixedGraphQ(_NetworkXBuiltin):
211208
"""
212209
<url>
213210
:Mixed Graph:
214-
https://en.wikipedia.org/wiki/Mixed_graph</url> test <url>:WMA:
215-
https://reference.wolfram.com/language/ref/MixedGraphQ.html</url>
211+
https://en.wikipedia.org/wiki/Mixed_graph</url> test (<url>:WMA:
212+
https://reference.wolfram.com/language/ref/MixedGraphQ.html</url>)
216213
217214
<dl>
218215
<dt>'MixedGraphQ'[$graph$]
@@ -297,7 +294,7 @@ class PathGraphQ(_NetworkXBuiltin):
297294
<url>
298295
:Path graph:
299296
https://en.wikipedia.org/wiki/Path_graph
300-
</url> (<url>
297+
</url> test (<url>
301298
:WMA:
302299
https://reference.wolfram.com/language/ref/PathGraphQ.html</url>)
303300
@@ -363,34 +360,34 @@ def eval(self, graph, expression, evaluation, options):
363360

364361
class PlanarGraphQ(_NetworkXBuiltin):
365362
"""
366-
<url>
367-
:Planar Graph:
368-
https://en.wikipedia.org/wiki/Planar_graph</url>
369-
370-
<dl>
371-
<dt>'PlanarGraphQ'[$g$]
372-
<dd>Returns True if $g$ is a planar graph and False otherwise.
373-
</dl>
363+
<url>
364+
:Planar Graph:
365+
https://en.wikipedia.org/wiki/Planar_graph</url> test (<url>
366+
:NetworkX:
367+
https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/
368+
generated/networkx.algorithms.planarity.check_planarity.html</url>, <url>
369+
:WMA:
370+
https://reference.wolfram.com/language/ref/PlanaGraphQ.html</url>)
374371
375-
>> PlanarGraphQ[CycleGraph[4]]
376-
= True
377372
378-
>> PlanarGraphQ[CompleteGraph[5]]
379-
= False
373+
<dl>
374+
<dt>'PlanarGraphQ'[$g$]
375+
<dd>Returns True if $g$ is a planar graph and False otherwise.
376+
</dl>
380377
381-
>> PlanarGraphQ[CompleteGraph[4]]
382-
= True
378+
>> PlanarGraphQ[CycleGraph[4]]
379+
= True
383380
384-
>> PlanarGraphQ[CompleteGraph[5]]
385-
= False
381+
>> PlanarGraphQ[CompleteGraph[5]]
382+
= False
386383
387-
#> PlanarGraphQ[Graph[{}]]
388-
= False
384+
#> PlanarGraphQ[Graph[{}]]
385+
= False
389386
390387
391-
>> PlanarGraphQ["abc"]
392-
: Expected a graph at position 1 in PlanarGraphQ[abc].
393-
= False
388+
>> PlanarGraphQ["abc"]
389+
: Expected a graph at position 1 in PlanarGraphQ[abc].
390+
= False
394391
"""
395392

396393
options = DEFAULT_GRAPH_OPTIONS
@@ -407,18 +404,17 @@ def eval(self, graph, expression, evaluation: Evaluation, options: dict):
407404

408405
class SimpleGraphQ(_NetworkXBuiltin):
409406
"""
410-
<url>
411-
:Simple graph:
407+
Simple (not multigraph)<url>
408+
:graph:
412409
https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)#Graph
413-
</url> (
414-
<url>
410+
</url> test (<url>
415411
:WMA:
416412
https://reference.wolfram.com/language/ref/SimpleGraphQ.html</url>)
417413
418414
<dl>
419415
<dt>'LoopFreeGraphQ'[$graph$]
420416
<dd>True if $graph$ is a 'Graph', loop-free and each pair of \
421-
vertices are connected at most by a single edge.
417+
vertices are connected at most by a single edge.
422418
</dl>
423419
424420
>> g = Graph[{1 -> 2, 2 -> 3, 3 <-> 4}]; SimpleGraphQ[g]
@@ -437,10 +433,10 @@ class SimpleGraphQ(_NetworkXBuiltin):
437433
= False
438434
"""
439435

440-
summary_text = "test if a graph is simple"
436+
summary_text = "test if a graph is simple (not multigraph)"
441437

442438
def eval(self, graph, expression, evaluation, options):
443-
"%(name)s[graph_, OptionsPattern[%(name)s]]"
439+
"LoopFreeGraphQ[graph_, OptionsPattern[LoopFreeGraphQ]]"
444440
graph = self._build_graph(graph, evaluation, options, expression, quiet=True)
445441
if graph:
446442
if graph.empty():

pymathics/graph/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class RandomGraph(_NetworkXBuiltin):
2121
"""
2222
<url>
23-
:WMA:https://reference.wolfram.com/language/ref/RandomGraph.html
23+
:WMA link:https://reference.wolfram.com/language/ref/RandomGraph.html
2424
</url>
2525
2626
<dl>

0 commit comments

Comments
 (0)