GraphTheory
Subgraph
construct subgraph of graph
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Subgraph(G, E, opts)
G
-
graph
E
set or list of edges
opts
(optional) one or more options as given below
removesingletons=truefalse
Specifies whether vertices with no neighbors in the constructed subgraph should be removed from the vertex list. The default value, false, leaves the vertex list exactly as it was given in G.
The Subgraph command returns the subgraph formed by a specified set (or list) of edges.
To induce a subgraph using a set of vertices, use the InducedSubgraph command.
with⁡GraphTheory:
K5≔CompleteGraph⁡5
K5≔Graph 1: an undirected graph with 5 vertices and 10 edge(s)
E≔1,2,1,4,2,3,3,4
H≔Subgraph⁡K5,E
H≔Graph 2: an undirected graph with 5 vertices and 4 edge(s)
evalb⁡Edges⁡H=E
true
HighlightSubgraph⁡K5,H
DrawGraph⁡K5
The GraphTheory[Subgraph] command was updated in Maple 2023.
The removesingletons option was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
DeleteEdge
HighlightSubgraph
InducedSubgraph
Download Help Document