Network::addEdge -- adds one or
several edges to a network
IntroductionNetwork::addEdge augments an existing network by new
edges
Call(s)Network::addEdge(G, e <, Eweight=c> <, Capacity=t>)
Network::addEdge(G, l <, Eweight=lc>
<, Capacity=lt>)
Parameterslc,lt |
- | lists of numbers |
c,t |
- | numbers |
l |
- | list of edges |
e |
- | edge |
G |
- | network |
OptionsEweight |
- | The weight(s) for the new edge(s). Default is 1. |
Capacity |
- | The capacity/capacities for the new edge(s). Default is 1. |
ReturnsThe augmented network
DetailsNetwork::addEdge adds one or several edges to an
already existing network. An edge is represented by a list containing
two nodes of the network. An error is raised if the specified edge is
already contained in the network.Network::addEdge(G,e) adds the edge
e to the network G. The endpoints of the edge
must be nodes of the network. Otherwise an error is raised. A weight
and a capacity can be set for the new edge with
Network::addEdge(G,e,Eweight=c,Capacity=t). If
these specifications are missing, the default values 1 are
assumed.Network::addEdge(G,l), where l
is a list of edges. For every edge in the list the endpoints have to be
nodes of the network. With Network::addEdge(G,l,Eweight=lc,Capacity=lt)
weights and capacities can be specified. Here lc and
lt are numerical lists with exactly the same number of
elements as l.
Example
1We construct a cyclic network and add a few edges.
>> N1 := Network::cycle([v1,v2,v3,v4]): Network::edge(N1)
[[v1, v2], [v2, v3], [v3, v4], [v4, v1]]
>> N2 := Network::addEdge(N1, [v1,v3]): Network::edge(N2)
[[v1, v2], [v2, v3], [v3, v4], [v4, v1], [v1, v3]]
Now, both v2 and v3 are direct
successors of v1.
>> Network::epost(N2)[v1];
[v2, v3]
Network::addEdge can augment a network with
weights and capacities.
>> N3 := Network::addEdge(N1, [[v1,v3],[v1,v4]], Capacity = [3,5]): Network::eCapacity(N3);
table(
[v1, v4] = 5,
[v1, v3] = 3,
[v4, v1] = 1,
[v3, v4] = 1,
[v2, v3] = 1,
[v1, v2] = 1
)
Network::AddEdges