src/Edge.cpp
/**
 * When a suffix ends on an implicit node, adding a new character
 * means spliting existing edge. This function is called
 * to split an edge at the point defnied by the suffix argument.
 * The existing edge loses its parent, as well as some of its leading
 * characters. New edge descends from the original parent,
 * and now has the existing edge as a child.
 * Since the existing edge is getting a new parent and starting
 * character, its hash table entry will no longer be valid. SO it must be
 * removed at the start of the function.  After the parent and start character
 * have been recalculated, it is inserted again.
 * The number of characters stolen from the original node and givn
 * to the new node is equal to the number of characters in the suffix
 * argument and it is (last - first + 1);
 */
When a suffix ends on an implicit node, adding a new character
means spliting existing edge. This function is called
to split an edge at the point defnied by the suffix argument.
The existing edge loses its parent, as well as some of its leading
characters. New edge descends from the original parent,
and now has the existing edge as a child.
Since the existing edge is getting a new parent and starting
character, its hash table entry will no longer be valid. SO it must be
removed at the start of the function.  After the parent and start character
have been recalculated, it is inserted again.
The number of characters stolen from the original node and givn
to the new node is equal to the number of characters in the suffix
argument and it is (last - first + 1).
When a suffix ends on an implicit node adding a new character means spliting existing edge . This function is called to split an edge at the point defnied by the suffix argument . The existing edge loses its parent as well as some of its leading characters . New edge descends from the original parent and now has the existing edge as a child . Since the existing edge is getting a new parent and starting character its hash table entry will no longer be valid . SO it must be removed at the start of the function . After the parent and start character have been recalculated it is inserted again . The number of characters stolen from the original node and givn to the new node is equal to the number of characters in the suffix argument and it is ( last - first + 1 ) .
int Edge::SplitEdge(Suffix &s) {
    Remove();
    Edge *new_edge = new Edge(first_char_index,
                              first_char_index + s.last_char_index - s.first_char_index,
                              s.origin_node);
    new_edge->Insert();
    Nodes[new_edge->end_node].suffix_node = s.origin_node;
    first_char_index += s.last_char_index - s.first_char_index + 1;
    start_node = new_edge->end_node;
    Insert();
    return new_edge->end_node;
}
int Edge :: SplitEdge ( Suffix & s ) { Remove ( ) ; Edge * new_edge = new Edge ( first_char_index , first_char_index + s . last_char_index - s . first_char_index , s . origin_node ) ; new_edge -> Insert ( ) ; Nodes [ new_edge -> end_node ] . suffix_node = s . origin_node ; first_char_index += s . last_char_index - s . first_char_index + 1 ; start_node = new_edge -> end_node ; Insert ( ) ; return new_edge -> end_node ; }
When a suffix ends on an implicit node, adding a new character
 means spliting existing edge.
When a suffix ends on an implicit node adding a new character means spliting existing edge .