<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>chain_struct</TITLE>
  <TYPE>Scilab function</TYPE>
  <DATE>September 1996</DATE>
  <SHORT_DESCRIPTION name="chain_struct"> chained structure from adjacency lists of a graph</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>[fe,che,fn,chn] = chain_struct(g)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[fe,che,fn,chn] = chain_struct(lp,la,ls)  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>g</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: graph list</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>lp</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector, pointer array of the adjacency lists description of the graph  (its size is the number of nodes of the graph + 1)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>la</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector, arc array of the adjacency lists description of the graph  (its size is the number of edges of the graph)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>ls</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector, node array of the adjacency lists description of the graph  (its size is the number of edges of the graph)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>fe</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector of the numbers of the first edges starting from nodes (its size is the number of nodes of the graph)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>che</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector of the numbers of the chained edges  (its size is the number of edges of the graph)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>fn</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector of the numbers of the first nodes reached by the edges of  <VERB>fe</VERB> (its size is the number of nodes of the graph)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>chn</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector of the nodes reached by the edges of <VERB>che</VERB></SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P><VERB>chain_struct</VERB> computes the row vectors of the edge chained structure 
    description of the graph <VERB>g</VERB>.
    It is also possible to give directly <VERB>chain_struct</VERB> the adjacency lists of
    the graph. This is more efficient if the adjacency lists are already
    available since <VERB>chain_struct</VERB> uses them to make computations.</P>
    <P>
    The vectors <VERB>fe</VERB>, <VERB>che</VERB>, <VERB>fn</VERB> and <VERB>chn</VERB> describe the
    chained structure in the following way:</P>
    <P><VERB>fe(i))</VERB> is the number of the first edge starting from node i</P>
    <P><VERB>che(fe(i))</VERB> is the number of the second edge starting from
    node i, <VERB>che(che(fe(i)))</VERB> is the number of the third edge starting from
    node i and so on until the value is 0</P>
    <P><VERB>fn(i)</VERB> is the number of the first node reached from node i</P>
    <P><VERB>ch(i)</VERB> is the number of the node reached by edge <VERB>che(i)</VERB>.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
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)
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>adj_lists</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>graph_2_mat</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
