({{, (RefLink[DirectedGraph, paclet:ref/DirectedGraph])[g] 
gives a directed graph from the undirected graph g.}, {, (RefLink[DirectedGraph, paclet:ref/DirectedGraph])[g,conv]
gives a directed graph using the conversion conv.}, {, (RefLink[DirectedGraph, paclet:ref/DirectedGraph])[{v->w,…},…]
uses rules v->w to specify the graph g.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[DirectedGraph, paclet:ref/DirectedGraph])[g] is equivalent to (RefLink[DirectedGraph, paclet:ref/DirectedGraph])[g,(RefLink[Automatic, paclet:ref/Automatic])].

The following conversions conv can be used:

(RefLink[DirectedGraph, paclet:ref/DirectedGraph]) takes the same options as (RefLink[Graph, paclet:ref/Graph]).

(RefLink[DirectedGraph, paclet:ref/DirectedGraph]) works with undirected graphs, multigraphs, and mixed graphs.

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Convert each undirected edge of the graph to both directions:

DirectedGraph[]

A random direction:

DirectedGraph[,"Random"]

A direction according to the vertex order in the vertex list:

DirectedGraph[,"Acyclic"]

OpenersExampleSection1(Spacer1)Scope  (6)

The input is unchanged for directed graphs:

DirectedGraph[]

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

DirectedGraph[]

Multigraphs:

DirectedGraph[]

Mixed graphs:

DirectedGraph[]

Use rules to specify the graph:

DirectedGraph[{1->2,2->3,3->4,4->1}]

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

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

DirectedGraph[g];//Timing

OpenersExampleSection3(Spacer1)Applications  (1)

Find strongly connected components in a random directed grid graph:

g=DirectedGraph[GridGraph[{10,20},VertexSize->Large],"Random"];

Highlight the components of size greater than 1:

components=Select[ConnectedComponents[g],Length[#]>1&];

HighlightGraph[g,Table[Style[components[[i]],ColorData[8][i]],{i,Length[components]}]]

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

A directed graph can be constructed by a list of (RefLink[DirectedEdge, paclet:ref/DirectedEdge]) objects:

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

DirectedGraphQ[%]

A graph is either undirected or directed:

g1=;g2=;

UndirectedGraphQ/@{g1,g2}

DirectedGraphQ/@{g1,g2}

A nonsymmetric adjacency matrix is interpreted to be a directed graph:

(m={{0,0,1},{1,0,1},{1,1,0}})//MatrixForm

SymmetricMatrixQ[m]

DirectedGraphQ[AdjacencyGraph[m]]

Use (RefLink[DirectedEdges, paclet:ref/DirectedEdges])->(RefLink[False, paclet:ref/False]) to interpret it as an undirected graph:

UndirectedGraphQ[AdjacencyGraph[m,DirectedEdges->False]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[UndirectedGraph, paclet:ref/UndirectedGraph])  ▪  (RefLink[AcyclicGraphQ, paclet:ref/AcyclicGraphQ])  ▪  (RefLink[DirectedGraphQ, paclet:ref/DirectedGraphQ])  ▪  (RefLink[UndirectedGraphQ, paclet:ref/UndirectedGraphQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Operations and Modifications, paclet:guide/GraphModifications])}})}})