UnderlyingGraph - Maple Help

GraphTheory

 UnderlyingGraph
 construct underlying graph

 Calling Sequence UnderlyingGraph(G,opts)

Parameters

 G - graph opts - (optional) one or more options as specified below

Options

 • directed=truefalse
 Specifies whether directed edges should be permitted in the graph returned. If true, the result will be a directed graph if the input was directed. The default value, false, produces an undirected graph.
 • multigraph=truefalse
 Specifies whether multiple edges should be included in the graph returned. If true, the result will contain any multiple edges present in the input. The default value, false, leaves only a single edge remaining in the output.
 • selfloops=truefalse
 Specifies whether self-loops should be included in the graph returned. If true, the result will contain any self-loops present in the input. The default value, false, excludes all self-loops from the output.
 • weighted=truefalse
 Specifies whether edge weights should be included in the graph returned. If true, the result will be a weighted graph if the input was weighted. The default value, false, produces an unweighted graph.

Description

 • The UnderlyingGraph(G,opts) command returns an underlying graph of a graph.
 • The default behavior produces a graph in which the directions of arcs and the weights of the edges (or arcs) have been dropped.
 • Note that UnderlyingGraph(G) = Graph(Vertices(G), Neighbors(G)).

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Digraph}\left(\left\{\left[1,2\right],\left[2,3\right],\left[3,4\right],\left[4,1\right]\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: a directed graph with 4 vertices and 4 arc\left(s\right)}}$ (1)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{1}{,}{2}\right]{,}\left[{2}{,}{3}\right]{,}\left[{3}{,}{4}\right]{,}\left[{4}{,}{1}\right]\right\}$ (2)
 > $\mathrm{Neighbors}\left(G\right)$
 $\left[\left[{2}{,}{4}\right]{,}\left[{1}{,}{3}\right]{,}\left[{2}{,}{4}\right]{,}\left[{1}{,}{3}\right]\right]$ (3)
 > $H≔\mathrm{UnderlyingGraph}\left(G\right):$
 > $\mathrm{Edges}\left(H\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}\right\}$ (4)
 > $\mathrm{Neighbors}\left(H\right)$
 $\left[\left[{2}{,}{4}\right]{,}\left[{1}{,}{3}\right]{,}\left[{2}{,}{4}\right]{,}\left[{1}{,}{3}\right]\right]$ (5)

Compatibility

 • The directed and weighted options were introduced in Maple 2019.