File: adj_lists.cat

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 (49 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download
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
44
45
46
47
48
49
adj_lists          Scilab Group          Scilab function          adj_lists
NAME
   adj_lists - computes adjacency lists
  
CALLING SEQUENCE
 [lp,la,ls] = adj_lists(g)
 [lp,la,ls] = adj_lists(directed,n,tail,head)
PARAMETERS
 g  : graph list
    
 directed
     : integer, 0 (undirected graph) or 1 (directed  graph)
    
 n  : integer, the number of nodes of the graph
    
 tail
     : the row vector of the numbers of the tail nodes of the graph (its size
    is the number of edges of the graph)
    
 head
     : the row vector of the numbers of the head nodes of the graph (its size
    is the number of edges of the graph)
    
 lp : row vector, pointer array of the adjacency lists description of the
    graph  (its size is the number of nodes of the graph + 1) 
    
 la : row vector, arc array of the adjacency lists description of the
    graph  (its size is the number of edges of the graph) 
    
 ls : row vector, node array of the adjacency lists description of the
    graph  (its size is the number of edges of the graph) 
    
DESCRIPTION
   adj_lists computes the row vectors of the adjacency lists description of 
  the graph g. It is also possible to give adj_lists the description of the
  graph given by the number of nodes  n and the row vectors tail and head.
  
EXAMPLE
 ta=[2 3 3 5 3 4 4 5 8];
 he=[1 2 4 2 6 6 7 7 4];
 g=make_graph('foo',1,8,ta,he);
 g('node_x')=[129 200 283 281 128 366 122 333];
 g('node_y')=[61 125 129 189 173 135 236 249];
 show_graph(g);
 [lp,la,ls]=adj_lists(g)
 [lp,la,ls]=adj_lists(1,g('node_number'),ta,he)
SEE ALSO
   chain_struct, graph_2_mat