Previous Page Next Page Contents

Network::shortPathTo -- shortest paths to one single node

Introduction

Network::shortPathTo(G, v) finds the shortest paths in the network G ending at node v.

Call(s)

Network::shortPathTo(G,v <, w> <, Length> <, Path>)

Parameters

G - network
v, w - nodes in the network

Options

Length - include table of path lengths; default if Path not given

Returns

a number, a table or a sequence of two tables

Details

Example 1

>> 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]:
   N1 := Network(V,Ed,Eweight=Ew, Capacity=Ecap, Vweight=Vw):
>> Network::shortPathTo(N1, 5)
                                 table(
                                   5 = 0,
                                   4 = 1,
                                   3 = 2,
                                   2 = 5,
                                   1 = 8
                                 )
>> Network::shortPathTo(N1, 5, Path)
                             table(
                               4 = [4, 5],
                               3 = [3, 5],
                               2 = [2, 4, 5],
                               1 = [1, 3, 5]
                             )

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000