~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/metanet/find_path.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function p=find_path(i,j,g)
 
2
// Copyright INRIA
 
3
[lhs,rhs]=argn(0)
 
4
if rhs<>3 then error(39), end
 
5
// check i and j
 
6
if prod(size(i))<>1 then
 
7
  error('First argument must be a scalar')
 
8
end
 
9
if prod(size(j))<>1 then
 
10
  error('Second argument must be a scalar')
 
11
end
 
12
// check g
 
13
check_graph(g)
 
14
// compute lp, la and ls
 
15
n=g('node_number')
 
16
ma=prod(size(g('tail')))
 
17
if g('directed')==1 then
 
18
  [lp,la,ls]=m6ta2lpd(g('tail'),g('head'),n+1,n)
 
19
else
 
20
  [lp,la,ls]=m6ta2lpu(g('tail'),g('head'),n+1,n,2*ma)
 
21
end
 
22
// compute path
 
23
[l,v]=m6dfs(i,lp,ls,n)
 
24
p=m6prevn2p(i,j,v,la,lp,ls,g('directed'))