SimpleGraph[g]
gives the underlying simple graph from the graph g.
SimpleGraph[{vw,…}]
uses rules vw to specify the graph g.
SimpleGraph
SimpleGraph[g]
gives the underlying simple graph from the graph g.
SimpleGraph[{vw,…}]
uses rules vw to specify the graph g.
Details and Options
- SimpleGraph is also known as strict graph.
- SimpleGraph[g] removes all self-loops and multiple edges between the same vertices.
- SimpleGraph preserves directed edges as directed. UndirectedGraph can be used to compute the underlying undirected graph.
- SimpleGraph works with undirected graphs, directed graphs, multigraphs, and mixed graphs.
Examples
open all close allScope (6)
SimpleGraph works with undirected graphs:
SimpleGraph[[image]]SimpleGraph[[image]]SimpleGraph[[image]]SimpleGraph[[image]]Use rules to specify the graph:
SimpleGraph[{1 -> 2, 2 -> 3, 3 -> 1, 1 -> 1}]SimpleGraph works with large graphs:
g = AdjacencyGraph[SparseArray[{{i_, i_} -> 1, {i_, j_} /; j == i + 1 -> 1}, {10 ^ 6, 10 ^ 6}]];Timing[h = SimpleGraph[g];]SimpleGraphQ /@ {g, h}EdgeCount /@ {g, h}Properties & Relations (7)
A graph with self-loops is not simple:
Graph[{12, 23, 31, 11}]{SimpleGraphQ[%], LoopFreeGraphQ[%]}A PathGraph is always simple:
g = PathGraph[Range[20]]{PathGraphQ[g], SimpleGraphQ [g]}A TreeGraph without multiple edges is simple:
g = CompleteKaryTree[3, 3]{TreeGraphQ[g], SimpleGraphQ [g]}The adjacency matrix of a simple graph has entries not greater than 1:
g = CycleGraph[4]SimpleGraphQ[g](m = AdjacencyMatrix[g])//MatrixFormDiagonal elements are all zeros:
Diagonal[m]//NormalThe incidence matrix of a simple graph has entries -1, 0, or 1 and no repeated column:
g = Graph[{12, 23, 31}]IncidenceMatrix[g]//MatrixFormAll vertices of a simple graph have a 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]See Also
Related Guides
Text
Wolfram Research (2010), SimpleGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/SimpleGraph.html (updated 2015).
CMS
Wolfram Language. 2010. "SimpleGraph." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/SimpleGraph.html.
APA
Wolfram Language. (2010). SimpleGraph. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SimpleGraph.html
BibTeX
@misc{reference.wolfram_2026_simplegraph, author="Wolfram Research", title="{SimpleGraph}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/SimpleGraph.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_simplegraph, organization={Wolfram Research}, title={SimpleGraph}, year={2015}, url={https://reference.wolfram.com/language/ref/SimpleGraph.html}, note=[Accessed: 13-June-2026]}