MoralGraph - Maple Help

GraphTheory

 MoralGraph
 construct moral graph

 Calling Sequence MoralGraph( G )

Parameters

 G - graph

Description

 • The MoralGraph( G ) command constructs the moral graph of the directed graph G.

Definition

 • The moral graph is a graph with the same vertices as G but with all directed edges made undirected and with the property that all pairs in G which share a child are connected.

Examples

Compute the moral graph of an acyclic directed graph.

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Graph}\left(7,\left\{\left[1,3\right],\left[2,3\right],\left[2,4\right],\left[3,5\right],\left[3,6\right],\left[3,7\right],\left[4,7\right]\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: a directed graph with 7 vertices and 7 arc\left(s\right)}}$ (1)
 > $\mathrm{NumberOfEdges}\left(G\right)$
 ${7}$ (2)
 > $\mathrm{DrawGraph}\left(G\right)$
 > $M≔\mathrm{MoralGraph}\left(G\right)$
 ${M}{≔}{\mathrm{Graph 2: an undirected graph with 7 vertices and 9 edge\left(s\right)}}$ (3)
 > $\mathrm{NumberOfEdges}\left(M\right)$
 ${9}$ (4)
 > $\mathrm{DrawGraph}\left(M\right)$

Compatibility

 • The GraphTheory[MoralGraph] command was introduced in Maple 2024.