Moral graph Created 2026-09-24 Updated 2026-10-05
The moral graph of a Directed acyclic graph joins every pair of vertices with a common child and then replaces every directed edge by an undirected edge.
If D-separation and conditional independence are equivalent for a Directed acyclic graph, its moral graph is its conditional independence graph. After conditioning on all other vertices, an active path can only be a direct edge or a two-edge collider through a common child: two adjacent interior vertices cannot both be colliders. These are exactly the moral edges.
Choose a strict total order of the vertices of a finite simple graph. Direct every edge from to when . Along every directed path, the index strictly increases. Returning to the starting vertex would require an impossible strict increase back to the initial index, so this is an acyclic orientation. The displayed comes from .
The chosen strict total order is a topological order of the resulting Directed acyclic graph. Conversely, every acyclic orientation of a finite simple graph has a topological order, and orienting its edges from earlier to later in that order recovers it. Different topological orders can induce the same acyclic orientation, since vertices with no edge between them need not impose a choice of arrow.[ref]
An order respects reachability but does not create it: in a chosen topological order does not imply a directed path from to . For example, orient the two edges of the graph path using . The arrows are and ; there is no directed path from to , despite . In , however, reaches both directly and via . Following outgoing directed edges with graph search decides this directional reachability.[ref]
Label the full siblings at the bottom and their cousin parents . Let have parents and parents , where are siblings with parents . Include the other great-grandparents as , parents of , and , parents of . This gives fourteen people, with six independent founders in a pedigree .
The pedigree graphical model has the following Directed acyclic graph, with both members of each parent pair pointing to every listed child:
Let be the founder genotype law under Hardy-Weinberg equilibrium, and let be the Mendelian segregation kernel. The joint probability of all genotypes is
For a biallelic locus with allele-1 frequency , , and . The kernel assigns probability to each labelled pair of parental transmissions and adds these probabilities when they produce the same unordered genotype. Summing this Bayesian network factorization over unobserved genotypes gives their marginal distribution or a pedigree likelihood.
Figure 1.
Genotype ancestry and the two fill edges for a first-cousin marriage pedigree
. Details.
In a minimum-cost flow problem, every directed arc has a per-unit cost and lower and upper capacities . Each vertex has a prescribed net supply , with . We seek flows minimizing subject to the flow conservation equations
The uncapacitated minimum-cost flow case has and, here, .
For project scheduling, augment the precedence graph with a source , of duration , and a sink . Join to every task with no predecessor, and every task with no successor to . Extend the precedence matrix to these dummy arcs. This augmentation is needed because the printed matrix by itself contains no start or finish vertex. Assuming the precedence graph is a Directed acyclic graph, every task lies on a source-to-sink path. Unlimited parallel work then gives the linear programming formulation
The time variables are unrestricted; a common translation changes nothing, so we may fix . These inequalities say that each successor starts after its predecessor finishes. In a topological order, their coordinatewise earliest solution is , the recursion of the critical path method.
To derive project scheduling duality, associate a nonnegative multiplier with . The Lagrangian is
Its infimum over the free time variables is finite precisely when the coefficients of all vanish. This gives one unit of net outflow at , one unit of net inflow at , and zero net flow at other vertices. Hence the dual is
Equivalently, minimize with . The project duration is the negative of the optimal minimum-cost flow value. The sign is essential: the dual of the minimization problem maximizes total duration, selecting a longest precedence path.
The network simplex algorithm is a general method for minimum-cost flow. After shifting lower bounds to zero, first find a feasible flow, using artificial arcs and a phase-one objective if needed. A network simplex tree basis fixes each non-tree arc at a bound and determines the tree flows by flow conservation. Choose network dual potentials making the network reduced cost
zero on the tree. An arc at its lower bound is improving if ; an arc at its upper bound is improving in reverse if . Adding that residual arc creates one fundamental cycle. Increase flow around this cycle until an arc reaches a bound, then exchange the entering and leaving tree arcs, or flip the entering arc to its other bound. The flow conservation equations remain satisfied. Use an anti-cycling rule for degenerate pivots. If a negative-cost residual cycle has no finite limiting capacity, the objective is unbounded below; if phase one cannot remove artificial flow, the problem is infeasible. Otherwise, termination with no negative residual network reduced costs certifies optimality, since potentials cancel around cycles and every residual network circulation has nonnegative cost.
For this project the augmented arcs are
In the specified initial spanning tree, the unique unit-flow path is . The flow on its arcs is one and that on all other tree arcs is zero. Its total cost is , so this is a degenerate but feasible network simplex tree basis. Normalizing , the tree equations give
There are two nonbasic arcs. Their network reduced costs are
Bring into the tree. The resulting cycle increases the flows on and decreases those on . The three decreasing arcs initially carry one unit, so the maximal step is one. Resolve the leaving-arc tie by removing . The resulting unit flow follows and has cost .
For the new tree, normalized potentials are
The only nonbasic arcs now have and , both nonnegative. All tree network reduced costs vanish, proving optimality after this single pivot. The earliest feasible schedule, obtained by the critical path method, is
The path has duration , so it and the timetable furnish a unit-flow certificate for project duration.
Model 2 is an errors-in-variables model: the follow-up regression depends on a latent true baseline rather than substituting its noisy observation. A common normal distribution for the true baselines provides partial pooling and allows uncertainty about each baseline to propagate to the regression coefficients and predictions. Conditional on the shared parameters, the child-specific factorization is
The Directed acyclic graph below includes the shared parameters, the two local latent variables, both observed measurements, and the deterministic regression mean. The outer plate repeats over children and the inner plate over follow-up visits. Filled nodes are observed; rectangular mean nodes are deterministic.
Figure 1.
Directed graph of the latent-baseline random-intercept model, including shared priors, baseline measurement error and repeated follow-up visits
. Details.
One complete adapted BUGS specification uses the non-centered form of the random intercept, retaining the original priors and adding proper broad priors for and :
for (i in 1:N) {
  z[i] ~ dnorm(0, 1)
  alpha[i] <- delta + tau*z[i]
  truebase[i] ~ dnorm(theta, baseprec)
  baseline[i] ~ dnorm(truebase[i], noiseprec)
  for (j in 1:3) {
    followmean[i,j] <- alpha[i] + beta*log(time[i,j]) + gamma*truebase[i]
    followup[i,j] ~ dnorm(followmean[i,j], noiseprec)
  }
}
noiseprec ~ dgamma(0.001, 0.001)
beta ~ dunif(-100, 100)
gamma ~ dunif(-100, 100)
delta ~ dunif(-100, 100)
tau ~ dunif(0, 100)
theta ~ dunif(-100, 100)
psi ~ dunif(0, 100)
baseprec <- 1/(psi*psi)
Here is the number of children, baseline and followup contain the observed data, and dnorm uses precision rather than variance. The priors on the newly introduced population baseline mean and standard deviation are explicit choices, not consequences of the likelihood; sensible alternatives can be checked for sensitivity. The code uses the noisy baseline only in its own measurement likelihood, and uses truebase in every follow-up mean.
Here a directed cycle has at least one edge. If zero-length paths were treated as cycles, an edgeless one-vertex graph would already satisfy the predicate; that convention would give the trivial nonempty-graph predicate instead of the intended directed cycle detection problem.
For NL membership, guess a starting vertex , follow a guessed directed walk for between one and edges, and accept if it returns to . Store only the start, current vertex and step counter. A graph with a nonempty closed walk contains a simple directed cycle of at most edges, including a self-loop if present. Thus the algorithm uses logarithmic space and is complete for the predicate.
For hardness, reduce the directed graph reachability problem to cycle detection. Form and add the single backward arc
All layering arcs advance exactly one layer, including the waiting arcs , so the layered graph alone is a Directed acyclic graph. Any cycle in the augmented graph must contain the backward arc and therefore contains a path from to .
If is reachable from in , use a simple path of length at most and pad it with waits to exactly steps. It becomes the required layered path and closes to a cycle. Conversely, projecting such a layered path and deleting waits gives a walk from to in . This includes the case , where reachability has a zero-length witness but the augmented graph has a genuinely positive-length cycle.
There are vertices and polynomially many arcs. A transducer enumerates pairs/layers and checks old adjacency by scanning its input, using only bits. Hence this is a logspace many-one reduction, proving
Write . The global Markov property for a directed acyclic graph says that, for every three pairwise disjoint vertex sets ,
Thus graphical D-separation implies probabilistic conditional independence. Causal minimality means that has this global Markov property for a directed acyclic graph, but has it for no proper subgraph of obtained by deleting edges while keeping all vertices. Faithfulness of a directed acyclic graph means that the displayed implication is an equivalence: the conditional independences of are exactly the D-separations of . In particular it includes the global Markov property for a directed acyclic graph.
A causally minimal distribution can nevertheless have an extra independence. Here is a causally minimal nonfaithful Gaussian model. Take three independent random variables , each with the standard normal distribution, and set
Use the Directed acyclic graph with edges , and . The equations give a directed acyclic graph factorization, so the global Markov property for a directed acyclic graph holds. Alternatively this complete acyclic graph imposes no nontrivial D-separations. But is independent of , even though the direct edge prevents their D-separation. Hence faithfulness of a directed acyclic graph fails.
To check causal minimality explicitly, the covariance matrix is
The linear transformation from to is invertible, so this is a nonsingular multivariate normal distribution. Deleting would require , whereas . Deleting would require , whereas the conditional covariance is
Deleting would require , whereas its conditional covariance is . By Gaussian conditional independence, each nonzero conditional covariance rules out the required independence. Every proper subgraph is contained in a graph obtained by a single edge deletion, and further deletion can only add Markov restrictions. Thus no proper subgraph is Markov for , proving causal minimality.
For the Markov blanket, use its standard convention that the focal vertex is excluded:
We prove Markov blanket D-separation by examining an arbitrary path from to . If its first edge points into , its next vertex is a parent of , hence a conditioned noncollider in , and the path is blocked. Otherwise the path starts at a child . If the next edge points out of , then is again a conditioned noncollider. If it points into , the path begins . Although conditioning on the collider opens that local segment, is another parent of , hence belongs to . The outgoing arrow makes a noncollider on the path, so conditioning on blocks it. Since is outside , none of these blocking vertices can be the endpoint.
Every path is therefore blocked by . Applying the global Markov property for a directed acyclic graph gives
This proves the requested screening property without any positivity assumption on .
Finally assume faithfulness of a directed acyclic graph and let have the stated screening property. Then and every vertex outside must be D-separated by . If a parent or child of were missing from , the one-edge path between them would be active, a contradiction. Thus every parent and child is in . If another parent of a child were missing from , the path would be active: its only interior vertex is the collider , already in . This is again a contradiction. Consequently
Under faithfulness the graphical blanket is contained in every screening set. This is the minimal Markov blanket under faithfulness; the preceding argument also shows that the blanket itself is a screening set.
The global Markov property for a directed acyclic graph requires, for all pairwise disjoint vertex sets , that D-separation of and by in implies . Two Markov equivalent directed acyclic graphs encode exactly the same such D-separations. The structural characterization is that they have the same skeleton of a directed graph and the same unshielded colliders. A distribution has faithfulness of a directed acyclic graph when its conditional independences are exactly those encoded by D-separation; this includes the global Markov implication as well as its converse.
The population PC algorithm uses an exact conditional independence oracle. Start with the complete undirected graph, and conditioning-set size . At each size, examine ordered adjacent pairs . Test subsets of size until independence is found or all such subsets have been examined. On finding it, delete and record a symmetric separating set . Ordered pairs ensure that subsets from either endpoint's neighbours are considered. Increase until no adjacent ordered pair has enough remaining neighbours to supply a set of that size. Rechecking eligibility after deletion, or freezing the neighbours at each level and then deleting, gives the same population skeleton under the hypothesis below.
Next, for each unshielded triple with nonadjacent, orient precisely when . Propagate directions that are forced without introducing a directed cycle or an additional unshielded collider. In particular, with nonadjacent forces ; an undirected edge with a directed path from to forces ; and with nonadjacent forces . The first avoids a new unshielded collider, the second a directed cycle. For the third, would force and to avoid cycles, creating the prohibited unshielded collider .
For a fully specified exact completion, list all acyclic orientations of the recovered skeleton which extend the collider arrows and have exactly the recorded unshielded colliders. Direct an edge if and only if all listed graphs orient it the same way; otherwise leave it undirected. This finite enumeration implements the definition of the completed partially directed acyclic graph; orientation propagation is the usual efficient way to obtain the same completion. The equivalence-class proof below uses the exact completion description and does not need an unproved completeness claim about a chosen subset of propagation rules.
To prove correctness, assume faithfulness of a directed acyclic graph to . A true edge cannot be D-separated by any set excluding its endpoints: its length-one path is always active. Thus a true edge is never deleted. Conversely, take nonadjacent and choose their order so that is earlier than in a topological ordering of . Then is a nondescendant and nonparent of . Its parent set gives D-separation of and . To see this local graphical fact, a path beginning is blocked by the conditioned parent , a noncollider. A path beginning with an arrow out of must encounter a first collider before reaching the nondescendant . That collider is a descendant of , and neither it nor any of its descendants can be a parent of in an acyclic graph. Hence conditioning on does not open it.
All parent edges survive. If has not already been deleted, remains among 's neighbours excluding . It is therefore tested by size , and faithfulness forces deletion. The size loop cannot stop prematurely while this set remains eligible. This proves exact recovery of the skeleton of a directed graph.
For an unshielded triple , if it is a noncollider in , its length-two path remains active unless is conditioned on. Thus every separator of contains . If it is a collider, conditioning on opens the length-two path, so no separator can contain . Faithfulness turns these graphical statements into the recorded separator test. Therefore the collider phase recovers precisely all unshielded colliders. By the skeleton and collider characterization of Markov equivalence, the acyclic extensions with exactly these colliders are exactly the Markov equivalence of directed acyclic graphs class of . In particular that set is nonempty, and the completion returns its CPDAG. This proves population PC correctness under faithfulness.
For the four-variable example, the only removable pairs are , with separator , and , with separator . The remaining skeleton has edges . The unshielded triples and both have center outside the separator of , so both are unshielded colliders. Every remaining edge is thereby oriented:
The other two unshielded triples are noncolliders, consistent with the separator of . There is no undirected edge left, so the equivalence class consists of this unique Directed acyclic graph. This identification is about the given faithful observational distribution; general PC algorithm outputs need not identify a unique causal direction.
Let contain independent complete observations of the -dimensional vector, and let be a Directed acyclic graph. A Gaussian Bayesian network uses, for node ,
Here is an intercept, the vector of parent coefficients, and the conditional variance; the vector collects these statistical parameters. Its likelihood function factors as
Choose a proper statistical parameter prior distribution and a graph prior distribution . Bayes' theorem gives the Bayesian network structure score, up to the normalization common to graphs,
The integral is Bayesian model evidence: it averages over nuisance parameters rather than substituting their best-fitting values. A graph prior can favor sparse graphs, while the evidence balances fit against the amount of prior statistical parameter space that predicts the observations well. Compare these scores over admissible Directed acyclic graphs, using enumeration when feasible or a search procedure otherwise; search need not find a global maximum, and observational data need not identify a unique causal orientation.
A conjugate prior makes the integral analytic. For example, for take , , where is positive-definite matrix and ; these are independent local normal-inverse-gamma priors. Under prior independence between nodes, the evidence is a product of local regression evidences. Each posterior has the same family, so the local integral is the ratio of prior and posterior normalization constants, with the likelihood's constants included. This avoids costly numerical integration and makes local graph updates inexpensive. Hyperparameters must be specified coherently if score equivalence between observationally equivalent graphs is desired; arbitrary local priors do not automatically have that property.
The moral graph of a Directed acyclic graph is formed by joining any two parents of a common child and then removing the directions from all edges. For D-separation, a path in the underlying undirected graph is active given when every noncollider on it is outside , and every collider has itself or a descendant in . Disjoint vertex sets and are D-separated by if no such active path connects them.
The adjacency characterization is
A one-edge path cannot be blocked by conditioning on other vertices. For a nonadjacent pair, choose the later vertex in a topological ordering. The earlier vertex is a nondescendant and is not a parent of , so the parents of separate the pair by the local Markov property of a directed acyclic graph.
Use faithfulness of a directed acyclic graph to mean that graphical and probabilistic independences agree, for all disjoint sets:
This includes the global Markov property of a directed acyclic graph as well as the absence of extra independences. The conditional independence graph of is the undirected graph in which is absent exactly when .
To identify this graph, condition on every vertex other than . Any noncollider in the interior of a path is then conditioned on, so an active path must have only colliders internally. Two adjacent interior vertices cannot both be colliders: the arrow joining them has an arrowhead at only one of its ends. Thus an active path can have no interior vertex, giving a direct edge, or just one, giving . In the latter case the conditioned common child activates the path. These possibilities are exactly the edges added or retained by moralization. Faithfulness therefore proves
This is why the moral graph equals the conditional independence graph under faithfulness.
For Gaussian graph estimation, collect the data into an matrix and let . The precision matrix has precisely for absent graph edges, by Gaussian conditional independence. In neighbourhood selection, fit a Lasso regression of each column on the others:
Select the nonzero coefficients as neighbours of , then make the graph undirected using either the OR rule, retaining an edge selected in at least one regression, or the AND rule, requiring both. These are instances of Nodewise Lasso.
The Graphical Lasso estimates the whole precision matrix jointly, for example by
Read off its nonzero off-diagonal entries as graph edges. This expression uses an off-diagonal penalty; an all-entry penalty is another convention.
To reduce computation in the PC algorithm, start its skeleton search from an estimate of the conditional independence graph rather than the complete graph. The exact graph contains the true DAG skeleton, so oracle tests can remove its extra edges while retaining the true adjacencies. Fewer initial edges and smaller neighbourhoods reduce both candidate pairs and candidate conditioning sets.
For correctness of the orientation stage, preserve valid separating-set records. With an exact conditional independence graph, an initially absent pair has the full complement as a separating set. Record that set, and record the usual discovered sets for edges removed later. Leaving an initially absent pair with an empty default could falsely mark an unshielded noncollider as a collider. This describes PC initialization from a conditional independence graph; with an estimated initial graph, screening errors can propagate into the output.
The probabilistic graphical model is the following Directed acyclic graph. The shared hyperparameters lie outside the plate; the plate repeats the local variables for . The observed colour is shaded, and the known error variance is a square.
Figure 1.
Graphical model for intrinsic supernova colour, dust reddening and measurement noise
. Arrows from to , from to , and from to the observed encode the conditional factorization. The plate encloses local supernova models. Details.
Thus the parent sets are . Independent hyperparameter prior factors are represented by the three root nodes. With the printed improper priors this is a factorization diagram; it becomes a normalized generative model after proper priors are supplied.
The Directed acyclic graph has arrows
The roots and are independent under their prior distributions; is fixed. Equivalently, the joint distribution factorizes as
Extend the original Directed acyclic graph with
The existing arrows and remain. The survey sample sizes and are fixed design variables, while is a deterministic node satisfying .
Let and . With the stated improper hyperpriors, the unnormalized posterior density is
Its Directed acyclic graph has, for each star, the arrows
followed by the deterministic observation arrows
The latent variables are repeated inside a plate indexed by ; all hyperparameters lie outside that plate.
For a distribution faithful to a Directed acyclic graph, the smallest Markov blanket of a vertex consists of
  • its parents,
  • its children, and
  • every other parent of one of its children.
Conditioning on this set blocks every path from the vertex to all remaining vertices. Each listed neighbor is necessary under faithfulness of a directed acyclic graph: omitting a parent or child leaves its direct edge active, while omitting a child's other parent leaves the collider path through that conditioned child active. Faithfulness rules out accidental cancellations that could otherwise make a smaller blanket sufficient.
A density factorizes according to a Directed acyclic graph when
where is the set of parents of vertex .
The required undirected graph is the moral graph: join every pair of parents having a common child, retain the parent-child adjacencies, and remove all arrowheads. Each DAG family is then a clique, so each conditional factor is a clique potential and the DAG factorization is also an undirected factorization. These edges are minimal for a guarantee covering every DAG-factorizing density, because an arbitrary conditional factor can couple every pair of variables in its family.
Initialize the PC skeleton search with an estimated conditional independence graph to reduce candidate pairs and conditioning sets. An exact graph contains the true Directed acyclic graph skeleton because it equals its moral graph under faithfulness. For initially absent pairs record the full complement as a separating set; an empty default can create false collider orientations. Estimation errors can affect this screening step.