Close
Close window
ContractSubgraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

GraphTheory

ContractSubgraph

contract subgraph to single vertex

Calling Sequence

ContractSubgraph(G, S)

Parameters

G

-

graph

S

-

set or list of vertices, or a subgraph of G

Description

The ContractSubgraph command returns a new graph with all the vertices in S merged into a single vertex. The neighborhood of the new vertex will be the union of the neighborhoods of all of merged vertices.

If S is given as a subgraph of G, all the vertices of S will be contracted.

To contract a single edge, use the Contract command.

Examples

>

withGraphTheory:

>

C6CycleGraph6

C6Graph 1: an undirected graph with 6 vertices and 6 edges

(1)
>

HContractSubgraphC6,1,2,6

HGraph 2: an undirected graph with 4 vertices and 4 edges

(2)
>

VerticesH

1,3,4,5

(3)
>

EdgesH

1,3,1,5,3,4,4,5

(4)
>

withSpecialGraphs:

>

PPetersenGraph

PGraph 3: an undirected graph with 10 vertices and 15 edges

(5)
>

DrawGraphP

>

HContractSubgraphP,1,2,3,6,7,9

HGraph 4: an undirected graph with 5 vertices and 7 edges

(6)
>

DrawGraphH

Compatibility

The GraphTheory[ContractSubgraph] command was introduced in Maple 2020.

For more information on Maple 2020 changes, see Updates in Maple 2020 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /