Previous Page Next Page Contents

Network::longPath -- longest paths from one single node

Introduction

Network::longPath(G, v) finds the longest path in network G starting from vertex v.

Call(s)

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

Parameters

G - a network
v,w - nodes in G

Options

Length - Return a table with the lengths of shortest paths
Path - Return a table with the paths themselves

Returns

a table, an integer or a list of nodes

Details

Example 1

We construct a network and try a few calls to Network::longPath:

>> V := [1,2,3,4,5]:
   Ed := [[1,2], [1,3], [2,3], [2,4], [3,4], [3,5], [4,5]]:
   Ew := [7, 6, 5, 4, 2, 2, 1]:
   N1 := Network(V, Ed, Eweight=Ew):
   Network::longPath(N1,1)
                                 table(
                                   5 = 15,
                                   4 = 14,
                                   3 = 12,
                                   2 = 7,
                                   1 = 0
                                 )
>> Network::longPath(N1,1,Path)
                          table(
                            5 = [2, 1, 2, 3, 4],
                            4 = [2, 1, 2, 3],
                            3 = [2, 1, 2],
                            2 = [2, 1]
                          )

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000