File: dfs2.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (43 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
      subroutine dfs2(i0,lp1,ls1,m,n,nn,num,pw,fin,nart,iart)
      implicit integer (a-z)
      dimension lp1(*),ls1(m),nn(n),num(n),pw(n),fin(n),nart(n)
      if (i0 .lt. 0 .or. i0 .gt. n) then
         call erro('bad internal node number')
         return
      endif
      iart=1
      do 10 i=1,n
         nart(i)=0
         pw(i)=0
         nn(i)=lp1(i+1)-lp1(i)
         num(i)=0
         fin(i)=100000
 10   continue
      pw(i0)=i0
      k=1
      num(i0)=k
      i=i0
 100  if(nn(i).eq.0) goto 200
      ll=lp1(i)+nn(i)-1
      j=ls1(ll)
      nn(i)=nn(i)-1
      if(pw(j).ne.0) goto 101
      fin(i)=min(fin(i),num(i))
      pw(j)=i
      k=k+1
      num(j)=k
      i=j
 101  fin(i)=min(fin(i),num(j))
      go to 100
 200  if(i.eq.i0) go to 1000
      q=fin(i)
      i=pw(i)
      fin(i)=min(q,fin(i))
      if(fin(i).ne.num(i)) goto 100
      if(fin(i).eq.1) goto 100
      nart(iart)=i
      iart=iart+1
      goto 100
 1000 continue
      return
      end