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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
chain_struct(1) Scilab function chain_struct(1)
NAME
chain_struct - chained structure from adjacency lists of a graph
CALLING SEQUENCE
[fe,che,fn,chn] = chain_struct(g)
[fe,che,fn,chn] = chain_struct(lp,la,ls)
PARAMETERS
g : graph list
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)
fe : row vector of the numbers of the first edges starting from nodes (its
size is the number of nodes of the graph)
che : row vector of the numbers of the chained edges (its size is the
number of edges of the graph)
fn : row vector of the numbers of the first nodes reached by the edges of
fe (its size is the number of nodes of the graph)
chn : row vector of the nodes reached by the edges of che
DESCRIPTION
chain_struct computes the row vectors of the edge chained structure
description of the graph g. It is also possible to give directly
chain_struct the adjacency lists of the graph. This is more efficient if
the adjacency lists are already available since chain_struct uses them to
make computations.
The vectors fe, che, fn and chn describe the chained structure in the fol-
lowing way:
fe(i)) is the number of the first edge starting from node i
che(fe(i)) is the number of the second edge starting from node i,
che(che(fe(i))) is the number of the third edge starting from node i and so
on until the value is 0
fn(i) is the number of the first node reached from node i
ch(i) is the number of the node reached by edge che(i).
EXAMPLE
ta=[1 1 2 3 5 4 6 7 7 3 3 8 8 5];
he=[2 3 5 4 6 6 7 4 3 2 8 1 7 4];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[116 231 192 323 354 454 305 155];
g('node_y')=[118 116 212 219 117 185 334 316];
show_graph(g);
[fe,che,fn,chn] = chain_struct(g)
SEE ALSO
adj_lists, graph_2_mat
|