networks
addvertex
add a vertex or set of vertices to a graph
Calling Sequence
Parameters
Description
Examples
addvertex(v1, G)
addvertex(v1, v2, G)
addvertex(v1, weights=w, G)
addvertex([v1, v2], weights=[w1, w2], G)
G
-
graph or network
v1, v2, ..., vn
new vertices for the graph G
w
user supplied weight for a vertex (default 0)
Important: The networks package has been deprecated. Use the superseding command GraphTheory[AddVertex] instead.
This routine adds one or more vertices to a graph. The vertex names used are returned as an expression sequence.
To force addvertex() to use a specific weight for a single vertex use the optional argument (eg. weights=3).
If more than one vertex is to be added, they can be presented as a list or set of vertices. In this case, non-default weights must also be specified as a list of weights as in: addvertex([1, 3], weights=[0, 0], G)
A vertex cannot be a symbol or string beginning with the letter e; these are reserved, by the package, for edge names.
This routine is normally loaded via the command with(networks) but can also be referenced using the full name networks[addvertex](...).
with⁡networks:
new⁡G:
addvertex⁡1,2,3,4,G:
addvertex⁡vname,xx,G:
vertices⁡G
1,2,3,4,vname,xx
vweight⁡1,G
0
addvertex⁡n1,n2,weights=5,symwt,G
n1,n2
vweight⁡n2,G
symwt
See Also
GraphTheory
GraphTheory[AddVertex]
networks(deprecated)[addedge]
networks(deprecated)[vertices]
with
Download Help Document