Network::changeVertex --
changes the weight of one or several vertices in a network
IntroductionNetwork::changeVertex(G, v, Vweight=c)
sets the weight of vertex v in network G to
c.
Call(s)Network::changeVertex(G, v <, Vweight=c>)
Network::changeVertex(G, l <, Vweight=lc>)
Parametersc |
- | a number |
l |
- | a list of nodes |
v |
- | a node of the network G |
lc |
- | a list of numbers |
G |
- | a network |
OptionsVweight |
- | the new weight(s) of the vertices |
Returnsthe augmented network
DetailsNetwork::changeVertex changes the weight of one or
several nodes in a network. An error is raised if the specified node is
not contained in the network.Network::changeVertex(G,v,Vweight=c)
changes the weight of node v in the network G
to the new value c.Network::changeVertex(G,l,Vweight=lc) where
l is a list of nodes and lc is a numerical
list with exactly the same number of elements as l. If one
of the specified nodes is not contained in the network an error is
raised.
Example
1We generate a cyclic path with default weights. Then, the vertex weights are changed.
>> N1 := Network::cycle([v1,v2,v3,v4]): Network::vWeight(N1)
table(
v4 = 0,
v3 = 0,
v2 = 0,
v1 = 0
)
>> N2 := Network::changeVertex(N1, [v1,v2,v3,v4],
Vweight=[1,2,3,4]):
Network::vWeight(N2)
table(
v4 = 4,
v3 = 3,
v2 = 2,
v1 = 1
)
Network::ChangeVertex