@@ -52,7 +52,7 @@ class AcyclicGraphQ(_NetworkXBuiltin):
5252
5353 summary_text = "test if is a graph is acyclic"
5454
55- def eval (self , graph , expression , evaluation , options ):
55+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
5656 "AcyclicGraphQ[graph_, OptionsPattern[AcyclicGraphQ]]"
5757 graph = self ._build_graph (graph , evaluation , options , expression , quiet = False )
5858 if not graph or graph .empty ():
@@ -73,7 +73,7 @@ class ConnectedGraphQ(_NetworkXBuiltin):
7373 #Connected_vertices_and_graphs
7474 </url> test (<url>
7575 :NetworkX:
76- https://networkx.org/documentation/networkx-2.8.8 /reference/algorithms\
76+ https://networkx.org/documentation/stable /reference/algorithms\
7777 /generated/networkx.algorithms.components.is_connected.html
7878 </url>, <url>
7979 :WMA:
@@ -111,7 +111,7 @@ class ConnectedGraphQ(_NetworkXBuiltin):
111111
112112 summary_text = "test if a graph is a connected"
113113
114- def eval (self , graph , expression , evaluation , options ):
114+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
115115 "%(name)s[graph_, OptionsPattern[%(name)s]]"
116116 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
117117 if graph :
@@ -127,7 +127,7 @@ class DirectedGraphQ(_NetworkXBuiltin):
127127 https://en.wikipedia.org/wiki/Directed_graph
128128 </url> test (<url>
129129 :NetworkX:
130- https://networkx.org/documentation/networkx-2.8.8 /reference\
130+ https://networkx.org/documentation/stable /reference\
131131 /generated/networkx.classes.function.is_directed.html
132132 </url>, <url>
133133 :WMA:
@@ -153,7 +153,7 @@ class DirectedGraphQ(_NetworkXBuiltin):
153153
154154 summary_text = "test if a graph is directed"
155155
156- def eval (self , graph , expression , evaluation , options ):
156+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
157157 "DirectedGraphQ[graph_, OptionsPattern[DirectedGraphQ]]"
158158 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
159159 if graph :
@@ -162,14 +162,39 @@ def eval(self, graph, expression, evaluation, options):
162162 return SymbolFalse
163163
164164
165+ class GraphQ (_NetworkXBuiltin ):
166+ """
167+ <url>:WMA link:
168+ https://reference.wolfram.com/language/ref/GraphQ.html</url>
169+ <dl>
170+ <dt>'GraphQ'[$graph$]
171+ <dd>True if $graph$ is a 'Graph'.
172+ </dl>
173+
174+ A graph with one one node and one self-looping edge:
175+ >> GraphQ[{1 -> 2, 2 -> 3, 3 -> 1}]
176+ = True
177+
178+ >> GraphQ[{1, 2, 3}]
179+ = False
180+ """
181+
182+ summary_text = "test object is a graph"
183+
184+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
185+ "GraphQ[graph_, OptionsPattern[GraphQ]]"
186+ graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
187+ return SymbolTrue if graph else SymbolFalse
188+
189+
165190class LoopFreeGraphQ (_NetworkXBuiltin ):
166191 """
167192 <url>
168193 :Loop-Free graph:
169194 https://en.wikipedia.org/wiki/Loop_(graph_theory)
170195 </url> test (<url>
171196 :NetworkX:
172- https://networkx.org/documentation/networkx-2.8.8 /reference/\
197+ https://networkx.org/documentation/stable /reference/\
173198 generated/networkx.classes.function.nodes_with_selfloops.html
174199 </url>, <url>
175200 :WMA:
@@ -195,7 +220,7 @@ class LoopFreeGraphQ(_NetworkXBuiltin):
195220
196221 summary_text = "test if a graph is loop free"
197222
198- def eval (self , graph , expression , evaluation , options ):
223+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
199224 "LoopFreeGraphQ[graph_, OptionsPattern[LoopFreeGraphQ]]"
200225 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
201226 if not graph or graph .empty ():
@@ -240,7 +265,7 @@ class MixedGraphQ(_NetworkXBuiltin):
240265
241266 summary_text = "test if a graph has directed and undirected edges"
242267
243- def eval (self , graph , expression , evaluation , options ):
268+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
244269 "MixedGraphQ[graph_, OptionsPattern[MixedGraphQ]]"
245270 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
246271 if graph :
@@ -254,7 +279,7 @@ class MultigraphQ(_NetworkXBuiltin):
254279 :Multigraph:
255280 https://en.wikipedia.org/wiki/Multigraph</url> test (<url>
256281 :NetworkX:
257- https://networkx.org/documentation/networkx-2.8.8 /reference/classes/multigraph.html</url>, \
282+ https://networkx.org/documentation/stable /reference/classes/multigraph.html</url>, \
258283 <url>
259284 :WMA:
260285 https://reference.wolfram.com/language/ref/MulitGraphQ.html</url>)
@@ -281,7 +306,7 @@ class MultigraphQ(_NetworkXBuiltin):
281306
282307 summary_text = "test if a graph is a multi graph"
283308
284- def eval (self , graph , expression , evaluation , options ):
309+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
285310 "MultigraphQ[graph_, OptionsPattern[MultigraphQ]]"
286311 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
287312 if graph :
@@ -339,7 +364,7 @@ class PathGraphQ(_NetworkXBuiltin):
339364
340365 summary_text = "test if a graph is a path-like graph"
341366
342- def eval (self , graph , expression , evaluation , options ):
367+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
343368 "PathGraphQ[graph_, OptionsPattern[PathGraphQ]]"
344369 if not isinstance (graph , Graph ) or graph .empty ():
345370 return SymbolFalse
@@ -365,7 +390,7 @@ class PlanarGraphQ(_NetworkXBuiltin):
365390 :Planar Graph:
366391 https://en.wikipedia.org/wiki/Planar_graph</url> test (<url>
367392 :NetworkX:
368- https://networkx.org/documentation/networkx-2.8.8 /reference/algorithms/
393+ https://networkx.org/documentation/stable /reference/algorithms/
369394 generated/networkx.algorithms.planarity.check_planarity.html</url>, <url>
370395 :WMA:
371396 https://reference.wolfram.com/language/ref/PlanaGraphQ.html</url>)
@@ -436,7 +461,7 @@ class SimpleGraphQ(_NetworkXBuiltin):
436461
437462 summary_text = "test if a graph is simple (not multigraph)"
438463
439- def eval (self , graph , expression , evaluation , options ):
464+ def eval (self , graph , expression , evaluation : Evaluation , options : dict ):
440465 "SimpleGraphQ[graph_, OptionsPattern[LoopFreeGraphQ]]"
441466 graph = self ._build_graph (graph , evaluation , options , expression , quiet = True )
442467 if graph :
0 commit comments