Network package

The functions of the Network package are called with, for example 
Network::MaxFlow(args).  This mechanism  prevents naming conflicts 
with other libraries. If this is too cumbersome then the methods
of the Network package can be exported. After export(Network,MaxFlow)
the routine for calculating maximum flows is globally available, i.e.
MaxFlow(args) can also be used. If a function with the name
MaxFlow already exists then export gives an error. The
value of the name must then be deleted.  With export(Network) all
methods of the Network package are exported.




Available Functions:
--------------------
AddEdge - adds one or several edges to a network
 AddEdge(G, e)
 AddEdge(G, e, <Eweight=c>, <Capacity=t>)
 AddEdge(G, [e1,..,en])
 AddEdge(G, [e1,..,en], <Cost=[c1,..,cn]>,<Capacity=[t1,..,tn]>)
 
AddVertex - adds one or several vertices to a network
 AddVertex(G,x)
 AddVertex(G,x,Vweight=n)
 AddVertex(G,[x1,..,xn])
 AddVertex(G,[x1,..,xn], Vweight=[v1,..vn])		

AllShortPath - shortest pathes for every pair (i,j)
 AllShortPath(G,<Length>,<Path>)
 Parameter: 
   G - Network
 AllShortPath(G) gives a table with the length of a shortest path between 
 two nodes i and j for every i and j. If the keyword 'Path' is given, then a
 table is returned, which contains a shortest path for every pair (i,j). If
 there is no entry for a pair (i,j), then j cannot be reached from i in the
 network. If 'Length' and 'Path' are specified, then the distance table and the
 path table are returned.
 
ChangeEdge - change cost/capacity of one or several edges in a network
 ChangeEdge(G, e, <Eweight=c>, <Capacity=t>)
 ChangeEdge(G, [e1,..,en], < Eweight=[c1,..,cn]>,<Capacity=[t1,..,tn]>)
 	
ChangeVertex - change the weight of one or several vertices in a network
 ChangeVertex(G,x,Vweight=n)
 ChangeVertex(G,[x1,..,xn], Vweight=[v1,..vn])
  
Complete - generate a complete network
 Complete(n)
 Paramters:
   n - non-negative integer
 Generates the complete network with n vertices
			
ConvertSSQ - converts a network to a single source, single sink network
 ConvertSSQ(N,q,s)
 Parameters:
   N - Network
   q - source (new node)
   s - sink (new node)
 Converts a network to a single source, single sink network.  The given 
 nodes q and s are inserted in the network. The are connected to the 
 other nodes in the following way:
   [q,i] for every i with Network::VWeight[i] > 0
   [i,s] for every i with Network::VWeight[i] < 0
   ECapacity[[q,i]] := VWeight[i]   EWeight[[q,i]] := 0
   ECapacity[[i,s]] := VWeight[i]   EWeight[[i,s]] := 0

Cycle - generates a cycle 
 Cycle(L)
 Parameters:
    L - list (of nodes)
 Cycle([v1,..,vn]) generates a cycle with the edges [v1,v2], [v2,v3], ... , 
 [v(n-1),vn], [vn,v1].

DelEdge - deletes an edge
 DelEdge(G,e)
 DelEdge(G,[e1,..,en])
 Parameters:
   G - network
   e - edge or list of edges
 Deletes the specified edge(s).
 
DelVertex - deletes a node 
 DelVertex(G,x)
 DelVertex(G,[x1,..,xn]
 Parameters:
   G - network
   x - node, list of nodes
 Deletes all specified nodes and the incident arcs from the network.
 	
ECapacity - returns all capacities of a network
 ECapacity(G)
 Parameters:
   G - Network	
   
EWeight - returns the edge weights of a network
 EWeight(G)
 Parameters:
   G - Network
   
Edge - returns all edges of a network
 Edge(G)
 Parameters:
   G - Network
   			
Epost - returns the adjacency list for outgoing edges
 Epost(G)
 Parameters:
   G - Network
   
Epre - returns the adjacency list for incoming edges
 Epre(G)
 Parameters:
   G - Network 
   			
InDegree - vertex indegrees of a network
 InDegree(G)
 InDegree(G,v)
 InDegree(G, [v1,..,vn])
 Parameters:
   G - network
   v,v1,..,vn - nodes of G
   		
IsEdge - checks whether an edge is contained in a network
 IsEdge(G,e)
 Parameters:
   G - Network
   e - edge
   
IsVertex - checks whether a vertex is contained in a network
 IsVertex(G,v)
 Parameters:
   G - Network
   v - Vertex

 LongPath - longest pathes for one node
 LongPath(G,v)
 LongPath(G,v,w)
 LongPath(G,v,<Path>, <Length>)
 LongPath(G,v,w,<Path>, <Length>)
 Parameters:
   G - Network
   v,w - node of the network G
   Path, Length - keywords

 LongPath(G,v) returns a table with the length of longest pathes from
 v to all other nodes in the network. LongPath(G,v,w) gives the length
 of a longest path from v to w. Uses Network::lbellman. If the optional
 argument Path is given, then a table with longest pathes are returned.
 If Length and Path are given, then both the length of the longest pathes
 and the pathes are returned.

MaxFlow - computes a maximal flow
 MaxFlow(G,q,s)
 Parameters:
   G - network
   q,s - vertices in G
 Computes a maximal flow from q to s in G.

MinCost - minimal cost flow
 MinCost(G)
 Parameters:
   G - network

MinCut - computes a minimal cut
 MinCut(G,q,s)
 Parameters:
   G - network
   q,s - vertices in G
 Computes a minimal cut seperating q and s in G.

OutDegree - vertex outdegrees of a network
 Out Degree(G)
 Out Degree(G,v)
 Out Degree(G, [v1,..,vn])
 Parameters:
   G - network
   v,v1,..,vn - nodes of G
   		
PrintGraph - print all known information about the network

Random - generates a random network
 Random(In, density, Kn)
 Parameters:
   In - Interval for number of nodes N ( In[1] <= N <= In[2])
   density - Density of graph: Number of edges = N^2 * density * 2
             (all edges are bidirectional)
   Kn - Interval for edge capacities
 Generates a random network N and returns [N, source, sink].
 Random() = Random([10,20], 0.5, [1,10])

ShortPath - shortest pathes from one single node
 ShortPath(G,v)
 ShortPath(G,v,w)
 ShortPath(G,v,<Path>, <Length>)
 ShortPath(G,v,w,<Path>, <Length>)
 Parameters:
   G - Network
   v,w - node of the network G
   Path, Length - keywords

 ShortPath(G,v) returns a table with the length of shortest pathes from 
 v to all other nodes in the network. ShortPath(G,v,w) gives the length 
 of a shortest path from v to w. Uses Network::dijkstra (if there are 
 only non-negative edge weights) and Network::bellman (if there are 
 negative edge weights).  If the optional argument Path is given, then 
 a table with shortest pathes are returned. If Length and Path are given, 
 then both the length of the shortest pathes and the pathes are returned.

ShowGraph - plots a network
 ShowGraph(N)
 Parameters:
   N - Network

TopSort - topological sorting of a network
 TopSort(G)
 Parameters:
   G - network
	
Vertex - returns all vertices of a network
 Vertex(G)
 Parameters:
   G - Network
   
VWeight - returns all vertex weights of a network
 VWeight(G)
 Parameters:
   G - Network




