networks
contract
contracts edges in a graph
Calling Sequence
Parameters
Description
Examples
contract(Eset, G)
contract(Pset, G)
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
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](...).
with⁡networks:
G≔complete⁡4:
v≔contract⁡1,4,G
v≔1
map(proc(e,G) [ e, ends(e,G) ] end proc, edges(G), G);
e1,1,2,e2,1,3,e4,2,3,e5,1,2,e6,1,3
e≔addedge⁡v,3,G
e≔e7
contract⁡v,3,G
1
e1,1,2,e2,1,e4,1,2,e5,1,2,e6,1
See Also
GraphTheory
GraphTheory[Contract]
networks(deprecated)[connect]
networks(deprecated)[delete]
with
Download Help Document