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

OpenersNotesSection(Spacer1)Details

A graph is directed if every edge in the graph is directed.

OpenersPrimaryExamplesSection(Spacer1)Examples  (12)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Test whether a graph is directed:

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

DirectedGraphQ[%]

(RefLink[DirectedGraphQ, paclet:ref/DirectedGraphQ]) gives (RefLink[False, paclet:ref/False]) for inputs that are not directed graphs:

CompleteGraph[5]

DirectedGraphQ[%]

OpenersExampleSection1(Spacer1)Scope  (6)

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

DirectedGraphQ[]

Directed graphs:

DirectedGraphQ[]

Multigraphs:

DirectedGraphQ[]

Mixed graphs:

DirectedGraphQ[]

(RefLink[DirectedGraphQ, paclet:ref/DirectedGraphQ]) gives (RefLink[False, paclet:ref/False]) for anything that is not a directed graph:

DirectedGraphQ[x]

DirectedGraphQ[Graph[garbage]]

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

GridGraph[{10,10,10,10}, DirectedEdges->True];

DirectedGraphQ[%] // Timing

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

A directed graph can have self-loops:

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

{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[{1\[DirectedEdge]2,2\[DirectedEdge]3,3\[DirectedEdge]1}]

DirectedGraphQ[g]

IncidenceMatrix[g]//MatrixForm

OpenersExampleSection5(Spacer1)Possible Issues  (1)

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

DirectedGraphQ[CompleteGraph[n]]

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

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