AI Glossary / Graphs and symbolic AI / Advanced
Directed graph
Definition
A directed graph, also called a digraph, represents objects as nodes and relationships as arrows from one node to another. Each edge has a specified starting node and ending node. An edge from A to B does not by itself establish an edge from B to A.
What it means
Direction preserves information that a simple connection can lose. A customer recommending a supplier, a document citing another document, and a process sending data to another process are relationships with distinct roles at their two ends.
A graph supplies a structure, not an automatic interpretation. An arrow might mean “sends to,” “depends on,” or “is a prerequisite for.” The last two conventions point in opposite directions for the same dependency, so the chosen meaning must be explicit. Neither an arrow nor a directed path alone proves causation.
How it works
For a graph without parallel edges, an edge can be represented as an ordered pair of nodes. A list of outgoing neighbors records the immediate destinations available from each node. Edge attributes can add information such as a relationship type, capacity, timestamp, or cost.
The in-degree counts incoming edges; the out-degree counts outgoing edges. Following consecutive arrows establishes directed reachability. Merely sharing an undirected connection does not establish a route in the required direction.
A directed graph can contain cycles. Strong connectivity requires directed reachability between every ordered pair of nodes; weak connectivity requires connectivity only after ignoring directions. A directed acyclic graph is a more restricted structure that excludes directed cycles.
Decide separately whether self-loops and parallel edges are allowed. NetworkX's DiGraph permits self-loops but does not preserve multiple parallel edges between the same ordered pair. Its MultiDiGraph supports that additional distinction. The appropriate representation depends on what separate relationship records mean.
Three practical examples
- Document discovery: A research assistant records a citation from document A to document B. Following outgoing links finds material A cites; following incoming links finds material citing A. Combining these questions without labels can confuse the history of an argument.
- Service analysis: A team maps which software service calls which other service. Outgoing links help identify dependencies under a caller-to-called convention. Incoming links help locate direct callers that might be affected by a change, subject to the actual call behavior.
- Recommendation feedback: A platform records which user recommended which item using distinct user and item nodes. The arrow identifies the recommender and recommendation target. Any later prediction about another user requires an additional model; the graph alone does not establish that prediction's reliability.
Think of it this way
Think of a map of one-way passages. Seeing that two locations are connected does not tell you that you can travel both ways. Before using the map, you also need to know whether its arrows describe permitted travel, recorded journeys, or something else entirely.
Worked example
Consider four nodes A, B, C, and D, with exactly these edges: A to B, B to C, C to A, and C to D. Treat every arrow as a permitted direct transfer and give each transfer equal cost.
A has in-degree 1 and out-degree 1. B also has in-degree 1 and out-degree 1. C has in-degree 1 and out-degree 2. D has in-degree 1 and out-degree 0. The in-degrees total 4 and the out-degrees total 4, each matching the number of edges.
Starting at A, a transfer can reach D through A-B-C-D in three steps. Starting at D, it cannot reach A or any other distinct node because D has no outgoing edge. The existence of the forward route does not supply a return route.
A, B, and C form a directed cycle and are mutually reachable. They form one strongly connected component; D forms another. The whole graph is weakly connected because ignoring the arrows leaves all four nodes connected, but it is not strongly connected.
Now add D to B as a fifth edge. D can reach B, then C, then A. Every node can now reach every other node, making the whole graph strongly connected. This changes reachability without removing the original cycle. It therefore does not make the graph acyclic.
Illustrative case study
Fictional Willow Services maintains a map where an arrow means “caller invokes destination.” A dashboard reports a service's outgoing connections as the number of other services that call it. The underlying records are correct, but the displayed interpretation reverses their meaning.
The team adds a visible direction legend and labels incoming and outgoing counts separately. Reviewers trace a small chain of real service calls before trusting the larger map. They also distinguish multiple recorded calls from distinct caller-destination relationships.
The revised analysis supports more accurate investigation of change impact. It still requires operational evidence: a possible call in the graph does not show whether that call occurs during every request.
Common misconceptions and mistakes
“Connected means mutually reachable.” Direction can prevent the return journey.
“A directed graph cannot contain cycles.” Only the acyclic subclass excludes them.
“Every repeated relationship record creates a distinct edge.” The selected representation may merge repeated pairs.
“An arrow means causes.” Its meaning comes from the model and supporting evidence.
“Reversing arrows preserves every answer.” It changes incoming and outgoing relationships and directed reachability queries.
Business use
Write a short definition of the node type and edge meaning before collecting records. Include direction in exports and diagrams, and decide whether repeated events should be aggregated or retained individually. This prevents a useful event history from silently becoming a different relationship model.
Choose measures that match the question. Incoming attention, outgoing dependence, and mutual reachability describe different features. Review missing links and the observation period before treating a graph as a complete picture of an organization or system.
People also ask
Can two nodes have arrows in both directions?
Yes; these are two distinct directed relationships.
Must arrows represent time order?
No. Their interpretation is application-specific.
Is a directed graph automatically a causal model?
No; causal interpretation requires additional assumptions and evidence.
Check your understanding
Can D reach A in the original example?
Answer: No, because D has no outgoing edges.
Why are A, B, and C mutually reachable?
Answer: Their arrows form a directed cycle.
What changes after adding D to B?
Answer: All four nodes become mutually reachable.
Related terms
- Node
- Directed acyclic graph
- directed edge
- in-degree
- out-degree
- directed path
- strongly connected component
- multigraph
Learn next
Draw the example and reverse every arrow. Recalculate the incoming and outgoing counts, then compare reachability from A and D. Explain which business questions each direction answers.
More in Graphs and symbolic AI
- Digital object memory - A digital object memory is an organized collection of digital information associated with an individual physical object over time.
- Dijkstra's algorithm - Dijkstra's algorithm finds minimum-total-cost paths from a starting node in a weighted graph whose edge weights are nonnegative.
- Dinitz - Dinitz is a maximum-flow algorithm that increases the amount of a single commodity sent from a source to a sink while respecting edge capacities and flow...
- Directional arc consistency - Directional arc consistency, or DAC, is a constraint-satisfaction property defined relative to a fixed ordering of variables.
- Dirichlet process - A Dirichlet process is a probability distribution over probability distributions.
- Disambiguation - Disambiguation is the process of determining which interpretation of an expression is intended when more than one is possible.
Sources
Aalto Dictionary of Machine Learning, directed graph and graph entries: https://aaltodictionaryofml.github.io/ADictML_Main.pdf Sedgewick and Wayne, directed-graph definitions, indexed text consulted: https://algs4.cs.princeton.edu/42digraph/ NetworkX, DiGraph representation: https://networkx.org/documentation/stable/reference/classes/digraph.html NetworkX, connectivity reference: https://networkx.org/documentation/stable/reference/algorithms/component.html
Previous: Directed cycle Next: Directional arc consistency