Network::epost, Network::epre
-- adjacency lists
IntroductionNetwork::epost(G) returns the direct successors of each
vertex in the network G.
Network::epre(G) returns the direct predecessors of
each vertex in the network G.
Call(s)Network::epost(G)
Network::epre(G)
ParametersG |
- | a network |
Returnsa table
DetailsNetwork::epost(G) returns a table with the adjacency
lists for outgoing edges. Thus Network::epost(G)[v] is a
list containing all those nodes w for which there is an
edge [v,w] in the network.Network::epre(G) returns a table with the adjacency
lists for incoming edges. Thus Network::epre(G)[v] is a
list containing all those nodes w for which there is an
edge [w,v] in the network.
Example
1Since networks are directed, the output of
epost and epre may differ:
>> V := [1,2,3,4,5]: Ed := [[1,2], [1,3], [2,3], [2,4], [3,4], [3,5], [4,5]]: N1 := Network(V, Ed): Network::epost(N1), Network::epre(N1)
table( table(
5 = [], 5 = [3, 4],
4 = [5], 4 = [2, 3],
3 = [4, 5],, 3 = [1, 2],
2 = [3, 4], 2 = [1],
1 = [2, 3] 1 = []
) )
Of course, it is possible to model undirected graphs
with the Network package:
>> N2 := Network::complete(4): Network::epost(N2), Network::epre(N2)
table( table(
4 = [1, 2, 3], 4 = [1, 2, 3],
3 = [1, 2, 4],, 3 = [1, 2, 4],
2 = [1, 3, 4], 2 = [1, 3, 4],
1 = [2, 3, 4] 1 = [2, 3, 4]
) )
[[