1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
4
<LANGUAGE>eng</LANGUAGE>
5
<TITLE>subgraph</TITLE>
6
<TYPE>Scilab function</TYPE>
7
<DATE>September 1996</DATE>
8
<SHORT_DESCRIPTION name="subgraph"> subgraph of a graph</SHORT_DESCRIPTION>
10
<CALLING_SEQUENCE_ITEM>g1 = subgraph(v,ind,g) </CALLING_SEQUENCE_ITEM>
15
<PARAM_NAME>v</PARAM_NAME>
17
<SP>: row vector, numbers of nodes or edges</SP>
21
<PARAM_NAME>ind</PARAM_NAME>
23
<SP>: string, 'nodes' or 'edges'</SP>
27
<PARAM_NAME>g</PARAM_NAME>
33
<PARAM_NAME>g1</PARAM_NAME>
35
<SP>: graph list of the new graph</SP>
41
<P><VERB>subgraph</VERB> returns the graph <VERB>g1</VERB>, built with the numbers given by the
42
the row vector <VERB>v</VERB>.
43
If <VERB>ind</VERB> is the string <VERB>'nodes'</VERB>, <VERB>g1</VERB> is built with the node
44
numbers given by <VERB>v</VERB> and the connected edges of these nodes in <VERB>g</VERB>.
45
If <VERB>ind</VERB> is the string <VERB>'edges'</VERB>, <VERB>g1</VERB> is built with the edge
46
numbers given by <VERB>v</VERB> and the tail-head nodes of these edges in <VERB>g</VERB>.</P>
48
All the characteristics of the old nodes and edges of <VERB>g</VERB> are preserved.</P>
52
ta=[1 1 2 2 2 3 4 5 5 7 8 8 9 10 10 10 10 10 11 12 13 13 13 14 15 16 16 17 17];
53
he=[2 10 3 5 7 4 2 4 6 8 6 9 7 7 11 13 13 15 12 13 9 10 14 11 16 1 17 14 15];
54
g=make_graph('foo',1,17,ta,he);
55
g('node_x')=[283 163 63 57 164 164 273 271 339 384 504 513 439 623 631 757 642];
56
g('node_y')=[59 133 223 318 227 319 221 324 432 141 209 319 428 443 187 151 301];
57
g('edge_color')=modulo([1:(edge_number(g))],15)+1;
58
g('node_diam')=[1:(g('node_number'))]+20;
62
g1=subgraph(v,'nodes',g);
64
v=[10 13 12 16 20 19];
67
g1=subgraph(v,'edges',g);
79
<LINK>delete_arcs</LINK>
82
<LINK>delete_nodes</LINK>
85
<LINK>supernode</LINK>