networks

 add an edge or set of edges to a graph

Parameters

 G - graph or network v1, v2, ..., vn - vertices of the graph G edg1 - name or string; user supplied name for an edge (default e.i) w - user supplied weight for an edge (default 1) Path - edges implicitly defined by a path through the specified vertices Cycle - edges implicitly defined by a cycle through the specified vertices

Description

 • Important: The networks package has been deprecated.  Use the superseding command GraphTheory[AddEdge] instead.
 • Add one or more edges to a graph by creating new edges for the specified sets or lists of vertices. An expression sequence of the names used for the new edges is returned.
 • An undirected edge is indicated by a set of vertices.
 • A directed edge is represented by a list of two vertices.  The tail is the first vertex and the head is the second vertex.
 • To force addedge() to use a specific name for a new edge use an optional argument names=edg1.  All edge names must be names or strings that begin with the letter e.
 • To force addedge() to use a specific weight use an optional argument (eg. weights=3).
 • If more than one edge is to be added the connections must be presented as a list or set of pairs of vertices.  In the case of lists of pairs of vertices, specific names and weights can still be provided by specifying names=L1 and weights=L2 where L1 and L2 are appropriate lists. To name or provide optional weights for more than one edge or vertex at a time then use lists for each of the required items.
 • This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[addedge](...).

Examples

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

 > $\mathrm{with}\left(\mathrm{networks}\right):$
 > $\mathrm{new}\left(G\right):$
 > $\mathrm{addvertex}\left(\left\{1,2,3,4\right\},G\right):$
 > $\mathrm{addedge}\left(\mathrm{Cycle}\left(1,2,3,4\right),G\right):$
 > $\mathrm{edg}≔\mathrm{addedge}\left(\left[1,2\right],G\right)$
 ${\mathrm{edg}}{:=}{\mathrm{e5}}$ (1)
 > $\mathrm{head}\left(\mathrm{edg},G\right)$
 ${2}$ (2)
 > $\mathrm{tail}\left(\mathrm{edg},G\right)$
 ${1}$ (3)
 > $\mathrm{addedge}\left(\left[1,2\right],\mathrm{names}=\mathrm{edg1},G\right)$
 ${\mathrm{edg1}}$ (4)
 > $\mathrm{addedge}\left(\left[\left\{1,2\right\},\left\{2,3\right\}\right],\mathrm{names}=\left[\mathrm{edg2},"edg3"\right],\mathrm{weights}=\left[0,0\right],G\right)$
 ${\mathrm{edg2}}{,}{"edg3"}$ (5)
 > $\mathrm{edges}\left(G\right)$
 $\left\{{"edg3"}{,}{\mathrm{e1}}{,}{\mathrm{e2}}{,}{\mathrm{e3}}{,}{\mathrm{e4}}{,}{\mathrm{e5}}{,}{\mathrm{edg1}}{,}{\mathrm{edg2}}\right\}$ (6)