({{, (RefLink[SimpleGraphQ, paclet:ref/SimpleGraphQ])[g] 
yields (RefLink[True, paclet:ref/True]) if the graph g is a simple graph and (RefLink[False, paclet:ref/False]) otherwise.}})

OpenersNotesSection(Spacer1)Details

A graph is simple if it has no self-loops or multiple edges between the same vertices.

OpenersPrimaryExamplesSection(Spacer1)Examples  (17)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Test whether a graph is simple:

GraphData["PappusGraph"]

SimpleGraphQ[%]

Not all graphs are simple:

DeBruijnGraph[2,2]

SimpleGraphQ[%]

OpenersExampleSection1(Spacer1)Scope  (5)

(RefLink[SimpleGraphQ, paclet:ref/SimpleGraphQ]) works with undirected graphs:

SimpleGraphQ[]

Directed graphs:

SimpleGraphQ[]

Multigraphs:

SimpleGraphQ[]

Mixed graphs:

SimpleGraphQ[]

(RefLink[SimpleGraphQ, paclet:ref/SimpleGraphQ]) works with large graphs:

GridGraph[{10,10,10,10}];

SimpleGraphQ[%]//Timing

OpenersExampleSection4(Spacer1)Properties & Relations  (8)

A graph with self-loops is not simple:

Graph[{1\[DirectedEdge]2,2\[DirectedEdge]3,3\[DirectedEdge]1,1\[DirectedEdge]1}]

{SimpleGraphQ[%],LoopFreeGraphQ[%]}

A simple graph can have a cycle:

GridGraph[{2,3}]

{SimpleGraphQ[%],AcyclicGraphQ[%]}

A simple graph can be bipartite:

CompleteGraph[{2,3}]

{SimpleGraphQ[%],BipartiteGraphQ[%]}

A (RefLink[PathGraph, paclet:ref/PathGraph]) is always simple:

g=GridGraph[{1,5}]

PathGraphQ[g]

SimpleGraphQ [g]

The adjacency matrix of a simple graph has zeros on the diagonal:

g=CycleGraph[4]

SimpleGraphQ[g]

Diagonal[AdjacencyMatrix[g]]//Normal

The incidence matrix of a simple graph has entries -1, 0, or 1:

g=Graph[{1\[DirectedEdge]2,2\[DirectedEdge]3,3\[DirectedEdge]1},EdgeStyle->Arrowheads[Small]]

IncidenceMatrix[g]//MatrixForm

All vertices of a simple graph have maximum degree less than the number of vertices:

g=WheelGraph[6]

SimpleGraphQ[g]

Max[VertexDegree[g]]<VertexCount[g]

A nontrivial simple graph must have at least one pair of vertices with the same degree:

g=GridGraph[{2,3}]

SimpleGraphQ[g]

VertexDegree[g]

OpenersExampleSection5(Spacer1)Possible Issues  (2)

A simple graph can have two edges between the same vertices but with opposite direction:

SimpleGraphQ[]

(RefLink[SimpleGraphQ, paclet:ref/SimpleGraphQ]) gives (RefLink[False, paclet:ref/False]) for non-explicit graphs:

SimpleGraphQ[CompleteGraph[n]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Graph, paclet:ref/Graph])  ▪  (RefLink[DirectedEdges, paclet:ref/DirectedEdges])  ▪  (RefLink[LoopFreeGraphQ, paclet:ref/LoopFreeGraphQ])  ▪  (RefLink[AdjacencyMatrix, paclet:ref/AdjacencyMatrix])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Properties & Measurements, paclet:guide/GraphPropertiesAndMeasurements])}, {▪(RefLinkPlain[Graph Predicates and Properties, paclet:guide/GraphPredicates])}})}})