Previous Page Contents

Network::new -- generates a new network

Introduction

Network(V, E) is used to generate a new Network with vertices V and edges E, which can be manipulated using the functions in the Network library.

Call(s)

Network::new(V, E)
Network::new(V, E <, Eweight=lc> <, Capacity=lt> <, Vweight=lv>)

Parameters

V - list of expressions (nodes)
E - list of edges

Options

Eweight=lc - The weights of the edges, given as a list of numbers
Capacity=lt - The capacity of the edges, given as a list of numbers
Vweight=lv - The weights of the vertices, given as a list of numbers

Returns

A Network

Details

Example 1

>> V := [1,2,3,q,s]:
   Edge := [[q,1], [1,2], [1,3], [2,3], [3,s]]:
   up := [5, 4, 4, 2, 5]:
   N1 := Network(V,Edge,Capacity=up):
   Network::printGraph(N1);
                         Vertices: [1, 2, 3, q, s]
      
              Edges: [[q, 1], [1, 2], [1, 3], [2, 3], [3, s]]
      
                Vertex weights: table(s=0,q=0,3=0,2=0,1=0)
      
      Edge capacities: table([3, s]=5,[2, 3]=2,[1, 3]=4,[1, 2]=4,[q,\
       1]=5)
      
      Edge weights: table([3, s]=1,[2, 3]=1,[1, 3]=1,[1, 2]=1,[q, 1]\
      =1)
      
       Adjacency list (out): table(s=[],q=[1],3=[s],2=[3],1=[2, 3])
      
        Adjacency list (in): table(s=[3],q=[],3=[1, 2],2=[1],1=[q])
>> V := [1,2,3,4,5]:
   Vw := [25,0,0,0,-25]:
   Ed := [[1,2], [1,3], [2,3], [2,4], [3,4], [3,5], [4,5]]:
   Ew := [7, 6, 5, 4, 2, 2, 1]:
   Ecap := [30, 20, 25, 10, 20, 25, 20]:
   N2 := Network(V,Ed,Eweight=Ew, Capacity=Ecap, Vweight=Vw):
   Network::printGraph(N2)
                         Vertices: [1, 2, 3, 4, 5]
      
      Edges: [[1, 2], [1, 3], [2, 3], [2, 4], [3, 4], [3, 5], [4, 5]]
      
               Vertex weights: table(5=-25,4=0,3=0,2=0,1=25)
      
      Edge capacities: table([4, 5]=20,[3, 5]=25,[3, 4]=20,[2, 4]=10\
      ,[2, 3]=25,[1, 3]=20,[1, 2]=30)
      
      Edge weights: table([4, 5]=1,[3, 5]=2,[3, 4]=2,[2, 4]=4,[2, 3]\
      =5,[1, 3]=6,[1, 2]=7)
      
      Adjacency list (out): table(5=[],4=[5],3=[4, 5],2=[3, 4],1=[2,\
       3])
      
      Adjacency list (in): table(5=[3, 4],4=[2, 3],3=[1, 2],2=[1],1=\
      [])

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000