DirectedGraph [g]
gives a directed graph from the undirected graph g.
DirectedGraph [g,conv]
gives a directed graph using the conversion conv.
DirectedGraph [{vw,…},…]
uses rules vw to specify the graph g.
DirectedGraph
DirectedGraph [g]
gives a directed graph from the undirected graph g.
DirectedGraph [g,conv]
gives a directed graph using the conversion conv.
DirectedGraph [{vw,…},…]
uses rules vw to specify the graph g.
Details and Options
- A directed graph is also known as a digraph.
- DirectedGraph [g] is equivalent to DirectedGraph [g,Automatic ].
- The following conversions conv can be used:
-
Automatic convert uv to both uv and vu"Acyclic" convert uv to uv if u precedes v in the vertex list and vu otherwise"Random" convert uv to either uv or vu randomly
- DirectedGraph takes the same options as Graph .
- DirectedGraph works with undirected graphs, multigraphs, and mixed graphs.
-
ImageMargins 0. the margins to leave around the graphicPreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic
List of all options
Examples
open all close allBasic Examples (3)
Convert each undirected edge of the graph to both directions:
A random direction:
A direction according to the vertex order in the vertex list:
Scope (6)
The input is unchanged for directed graphs:
DirectedGraph works with undirected graphs:
Multigraphs:
Mixed graphs:
Use rules to specify the graph:
DirectedGraph works with large graphs:
Applications (1)
Find strongly connected components in a random directed grid graph:
Highlight the components of size greater than 1:
Properties & Relations (3)
A directed graph can be constructed by a list of DirectedEdge objects:
A graph is either undirected or directed:
A nonsymmetric adjacency matrix is interpreted to be a directed graph:
Use DirectedEdges->False to interpret it as an undirected graph:
Related Guides
Text
Wolfram Research (2010), DirectedGraph, Wolfram Language function, https://reference.wolfram.com/language/ref/DirectedGraph.html (updated 2015).
CMS
Wolfram Language. 2010. "DirectedGraph." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/DirectedGraph.html.
APA
Wolfram Language. (2010). DirectedGraph. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirectedGraph.html
BibTeX
@misc{reference.wolfram_2025_directedgraph, author="Wolfram Research", title="{DirectedGraph}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/DirectedGraph.html}", note=[Accessed: 05-December-2025]}
BibLaTeX
@online{reference.wolfram_2025_directedgraph, organization={Wolfram Research}, title={DirectedGraph}, year={2015}, url={https://reference.wolfram.com/language/ref/DirectedGraph.html}, note=[Accessed: 05-December-2025]}