1 /* Et-forest data structure implementation.
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* This package implements ET forest data structure. Each tree in
19 the structure maintains a tree structure and offers logarithmic time
20 for tree operations (insertion and removal of nodes and edges) and
21 poly-logarithmic time for nearest common ancesto.
23 ET tree strores its structue as a sequence of symbols obtained
29 for each child c of node do
30 s = concat (s, c, node);
42 the sequence is 1 2 4 2 5 3 1 3 1 4 1.
44 The sequence is stored in a sligtly modified splay tree.
45 In order to support various types of node values, a hashtable
46 is used to convert node values to the internal representation. */
56 #endif /* __cplusplus */
58 typedef struct et_forest
*et_forest_t
;
59 typedef struct et_forest_node
*et_forest_node_t
;
61 extern et_forest_t et_forest_create
PARAMS ((void));
63 extern void et_forest_delete
PARAMS ((et_forest_t
));
65 extern et_forest_node_t et_forest_add_node
PARAMS ((et_forest_t
, void *));
66 extern int et_forest_add_edge
PARAMS ((et_forest_t
, et_forest_node_t
,
68 extern void et_forest_remove_node
PARAMS ((et_forest_t
, et_forest_node_t
));
69 extern int et_forest_remove_edge
PARAMS ((et_forest_t
, et_forest_node_t
,
71 extern et_forest_node_t et_forest_parent
PARAMS ((et_forest_t
, et_forest_node_t
));
72 extern et_forest_node_t et_forest_common_ancestor
PARAMS ((et_forest_t
,
75 extern void * et_forest_node_value
PARAMS ((et_forest_t
, et_forest_node_t
));
76 extern int et_forest_enumerate_sons
PARAMS ((et_forest_t
, et_forest_node_t
,
81 #endif /* __cplusplus */
83 #endif /* _ET_TREE_H */