Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to build a program to construct a suffix tree of XML document using this pseudo code algorithm.
We want to build a suffix tree corresponding to suffix tree of string, but rather than string we use XML tree elements as input.

VB
Input: an XML tree T
Output: suffix tree T’
Program Construction_XML_Suff
Create node p ← T.root;
Create node p’← T’.root;
Create Link sufixLink, add p’ into sufixLink;
Create Array a;/*store the Temporal Code of node*/
While p <>null do
Call Get_Next_Node;
Call Add_p_to_T’;
End While
End

Procedure Get_Next_Node
If(p not exist child or all children of p have traveled)
Call Set_SiffixLink;
End If
p=p.nextNode;/*in pretravel order ,if p have no next node, A=null*/
End Procedure

Procedure Set_SiffixLink
s=suffixLink.head;
While s<>null
If s.father<>null
s =s.father;
Else
q=s;
Remove q from suffixLink;
End If
s=s.next;
End While
End Procedure

Procedure Add_p_to_T’
s = siffixLink.head;
While s<>null
If s.sementicPath equals p. sementicPath
s={p}∪s;
Else
Create node m;
m.value = p.value;
m. sementicPath = p. sementicPath;
Add m as s’s child;
S=m;
End IF
S=s.next;
End While
End Procedure


the real problem I encountered is how to manipulate the suffix links here.
Any help for this issue?
Posted
Updated 14-Jul-12 0:17am
v3
Comments
Sergey Alexandrovich Kryukov 13-Jul-12 18:26pm    
Not clear what's the problem, what's the "suffix", how you want to "manipulate" it. .NET? Your language, platform? Click, "Improve question" above and, well, improve it. Start with the explanation of your goals.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900