File: trans_closure.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (30 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (2)
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
function g1=trans_closure(g)
// Copyright INRIA
[lhs,rhs]=argn(0)
if rhs<>1 then error(39), end
// check g and connectivity (checking of g made in is_connex)
if is_connex(g)<>1 then
  error('The graph must be connected')
end
// compute lp, la and ls
n=g('node_number')
ma=prod(size(g('tail')))
if g('directed')==1 then
  [lp,la,ls]=m6ta2lpd(g('tail'),g('head'),n+1,n)
else
  error('The graph must be directed')
end
// compute lp1 and ls1 for the transitive closure
[lp1,ls1]=m6transc(lp,ls,n)
// compute tail1 and head1 (without checking) for the transitive closure
n1=prod(size(lp1))-1
m1=prod(size(ls1))
la1=1:m1
[tail1,head1]=m6lp2tad(lp1,la1,ls1,n1)
// compute transitive closure graph
g1=glist(g('name')+'_trans_closure',g('directed'),n1,tail1,head1,..
g('node_name'),g('node_type'),g('node_x'),g('node_y'),g('node_color'),..
g('node_diam'),g('node_border'),g('node_font_size'),g('node_demand'),..
[],[],[],[],[],[],[],[],[],[],[],[],..
g('default_node_diam'),g('default_node_border'),g('default_edge_width'),..
g('default_edge_hi_width'),g('default_font_size'),[],[])