WLJS LogoWLJS Notebook

UndirectedGraphQ

UndirectedGraphQ[g] yields True if the graph g is an undirected graph and False otherwise.

Examples

Check if a graph is undirected:

g = Graph[{1 <-> 2, 2 <-> 3}];
UndirectedGraphQ[g]
(* True *)

Directed graph:

g = Graph[{1 -> 2, 2 -> 3}];
UndirectedGraphQ[g]
(* False *)

Convert and check:

UndirectedGraphQ[UndirectedGraph[{1 -> 2, 2 -> 3}]]
(* True *)

Please visit the official Wolfram Language Reference for more details.

On this page