DirectedGraphQ
Examples
open all close allBasic Examples (2)
Test whether a graph is directed:
Graph[{12, 23, 31}]DirectedGraphQ[%]DirectedGraphQ gives False for inputs that are not directed graphs:
CompleteGraph[5]DirectedGraphQ[%]Scope (6)
DirectedGraphQ works with undirected graphs:
DirectedGraphQ[[image]]DirectedGraphQ[[image]]DirectedGraphQ[[image]]DirectedGraphQ[[image]]DirectedGraphQ gives False for anything that is not a directed graph:
DirectedGraphQ[x]DirectedGraphQ[Graph[garbage]]DirectedGraphQ works with large graphs:
GridGraph[{10, 10, 10, 10}, DirectedEdges -> True];DirectedGraphQ[%] // TimingProperties & Relations (3)
A directed graph can have self-loops:
Graph[{12, 22}]{DirectedGraphQ[%], LoopFreeGraphQ[%]}A nonsymmetric adjacency matrix corresponds to a directed graph:
m = {{0, 1, 0}, {0, 0, 1}, {1, 1, 0}}; MatrixForm[m]SymmetricMatrixQ[m]DirectedGraphQ[AdjacencyGraph[m]]The incidence matrix of a directed graph has at least one entry that is -1:
g = Graph[{12, 23, 31}]DirectedGraphQ[g]IncidenceMatrix[g]//MatrixFormPossible Issues (1)
DirectedGraphQ gives False for non-explicit graphs:
DirectedGraphQ[CompleteGraph[n]]Related Guides
History
Text
Wolfram Research (2010), DirectedGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DirectedGraphQ.html.
CMS
Wolfram Language. 2010. "DirectedGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DirectedGraphQ.html.
APA
Wolfram Language. (2010). DirectedGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirectedGraphQ.html
BibTeX
@misc{reference.wolfram_2026_directedgraphq, author="Wolfram Research", title="{DirectedGraphQ}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/DirectedGraphQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_directedgraphq, organization={Wolfram Research}, title={DirectedGraphQ}, year={2010}, url={https://reference.wolfram.com/language/ref/DirectedGraphQ.html}, note=[Accessed: 13-June-2026]}