Re: SiteMap
| From: | Sebastian Bergmann | Date: | Thu, 14 Sep 2000 08:56:17 +0000 |
| Subject: | Re: SiteMap | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16741@lists.php.net to get a copy of this message | ||
Maurizio Firmani wrote:
> Could you please explain it better?
> Sorry, but I don't know what a direct graph or adiacency list is.
A "Directed Graph" is a very common data structure in computer science,
you may have heard of a field "Graph Theory".
A graph is defined as G = (V,E), where V is a set of vertices, and E
beeing a set of edges between the vertices.
Your documents can now be understood as vertices and links between
dosuments are the edges.
The adjacency-list representation of a graph G = (V,E) consists of an
array Adj of |V| lists, one for each vertex in V. For each such vertex the
adjacency list Adj[u] contains (pointers to) all the vertices v such that
there is an edge (u,v) in E. That is, Adj[u] consists of all the vertices
adjacent to u in G.
So, in our application we may have the following situation:
Document A -> Document B
Document A -> Document C
Document B -> Document C
(-> represents a link between two documents)
Our array for the adjacency-list would now look as follows:
$adjacency_list[ "A" ][ 0 ] = "B"; // A -> B
$adjacency_list[ "A" ][ 0 ] = "C"; // A -> C
$adjacency_list[ "B" ][ 0 ] = "C"; // B -> C
Hope that helps,
Sebastian
--
<?php $a=explode(" " ,"119 130 128 129 45 110 123 124 129 117 114 127 45 ".
"125 117 125 45 117 110 112 120 114 127");for($i=0;$i<sizeof($a);$i++)print
chr($a[$i]-13); /* http://sb.phpOpenTracker.de |
sb@phpOpenTracker.de */ ?>