networks(deprecated)/contract - Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : networks(deprecated)/contract

networks

 contract
 contracts edges in a graph

 Calling Sequence contract(Eset, G) contract(Pset, G)

Parameters

 G - graph or network Eset - edge or set or list of edges of G Pset - connected vertex pair or a set or list of connected vertex pairs

Description

 • Important: The networks package has been deprecated.  Use the superseding command GraphTheory[Contract] instead.
 • This procedure contracts the edges of G, specified by the first argument.
 • The edges to be contracted may be specified either individually or as a set of edge names or pairs of ends of edges (for example, {1,3} ).
 • If pairs of ends are used, each pair must uniquely identify an edge.
 • This procedure returns as its value the name of the vertex that survived the contraction of the specified edge. If more than one edge is contracted, then a set of surviving names is provided.
 • This routine is normally loaded by using the command with(networks), but it may also be referenced by using the full name networks[contract](...).

Examples

Important: The networks package has been deprecated.  Use the superseding command GraphTheory[Contract] instead.

 > $\mathrm{with}\left(\mathrm{networks}\right):$
 > $G≔\mathrm{complete}\left(4\right):$
 > $v≔\mathrm{contract}\left(\left\{1,4\right\},G\right)$
 ${v}{≔}{1}$ (1)
 > map(proc(e,G) [ e, ends(e,G) ] end proc, edges(G), G);
 $\left\{\left[{\mathrm{e1}}{,}\left\{{1}{,}{2}\right\}\right]{,}\left[{\mathrm{e2}}{,}\left\{{1}{,}{3}\right\}\right]{,}\left[{\mathrm{e4}}{,}\left\{{2}{,}{3}\right\}\right]{,}\left[{\mathrm{e5}}{,}\left\{{1}{,}{2}\right\}\right]{,}\left[{\mathrm{e6}}{,}\left\{{1}{,}{3}\right\}\right]\right\}$ (2)
 > $e≔\mathrm{addedge}\left(\left[v,3\right],G\right)$
 ${e}{≔}{\mathrm{e7}}$ (3)
 > $\mathrm{contract}\left(\left[v,3\right],G\right)$
 ${1}$ (4)
 > map(proc(e,G) [ e, ends(e,G) ] end proc, edges(G), G);
 $\left\{\left[{\mathrm{e1}}{,}\left\{{1}{,}{2}\right\}\right]{,}\left[{\mathrm{e2}}{,}\left\{{1}\right\}\right]{,}\left[{\mathrm{e4}}{,}\left\{{1}{,}{2}\right\}\right]{,}\left[{\mathrm{e5}}{,}\left\{{1}{,}{2}\right\}\right]{,}\left[{\mathrm{e6}}{,}\left\{{1}\right\}\right]\right\}$ (5)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam