lisa/src/main/java/it/unive/lisa/analysis/nonrelational/value/impl/stringgraphdomain/SGNUtils.java
public static StringGraphNode<?> compact(StringGraphNode<?> node) {
        if (node == null)
            return null;

        StringGraphNode<?> newNode = deepClone(node);
        if (newNode != null) {
            int hash;
            do {
                hash = newNode.hashCode();
                newNode = compactAux(newNode);
            } while (newNode != null && !(newNode.hashCode() == hash));
            return newNode;
        } else {
            return null;
        }
    }
/**
     * Type graph compaction algorithm, taken from
     * <a href="https://lirias.kuleuven.be/bitstream/123456789/132040/1/cw108.pdf">
     *     Deriving descriptions of possible values of program variables by means of abstract interpretation: definitions and proofs.
     *     G. Jannsens, M. Bruynooghe, Report CW 108, April 1990
     * </a>
     * Algorithm 4.1.
     *
     * Moreover, there are some additional rules to apply in the case of string graphs, concerning the particular
     * case of the functor nodes CONCAT/k. Such rules can be found in the paper
     * <a href="https://onlinelibrary.wiley.com/doi/full/10.1002/spe.2218">
     *      A suite of abstract domains for static analysis of string values
     *      Giulia Costantini, Pietro Ferrara, Agostino Cortesi
     * </a> at section 4.4.1.
     * In this context such restrictions are applied to normal string graphs, but by the fact that a
     * normal string graph is a particular case of a compact string graph, and since compaction algorithm is not applied
     * alone anywhere, it is safe here to apply such restrictions in the compaction process. Moreover, these restrictions
     * are more a matter of compaction then of normalization, since they do not concern the definition of
     * "principal label restriction".
     *
     * @param node The node to be compacted
     * @return a StringGraphNode, result of the compaction of <code>node</code>
     */
Type graph compaction algorithm, taken from

Deriving descriptions of possible values of program variables by means of abstract interpretation: definitions and proofs.
G. Jannsens, M. Bruynooghe, Report CW 108, April 1990

Algorithm 4.1.

Moreover, there are some additional rules to apply in the case of string graphs, concerning the particular
case of the functor nodes CONCAT/k. Such rules can be found in the paper

A suite of abstract domains for static analysis of string values
Giulia Costantini, Pietro Ferrara, Agostino Cortesi
 at section 4.4.1.
In this context such restrictions are applied to normal string graphs, but by the fact that a
normal string graph is a particular case of a compact string graph, and since compaction algorithm is not applied
alone anywhere, it is safe here to apply such restrictions in the compaction process. Moreover, these restrictions
are more a matter of compaction then of normalization, since they do not concern the definition of
"principal label restriction".

@param node The node to be compacted
@return a StringGraphNode, result of the compaction of node
Type graph compaction algorithm taken from Deriving descriptions of possible values of program variables by means of abstract interpretation : definitions and proofs . G . Jannsens M . Bruynooghe Report CW 108 April 1990 Algorithm 4 . 1 . Moreover there are some additional rules to apply in the case of string graphs concerning the particular case of the functor nodes CONCAT / k . Such rules can be found in the paper A suite of abstract domains for static analysis of string values Giulia Costantini Pietro Ferrara Agostino Cortesi at section 4 . 4 . 1 . In this context such restrictions are applied to normal string graphs but by the fact that a normal string graph is a particular case of a compact string graph and since compaction algorithm is not applied alone anywhere it is safe here to apply such restrictions in the compaction process . Moreover these restrictions are more a matter of compaction then of normalization since they do not concern the definition of " principal label restriction " . @param node The node to be compacted @return a StringGraphNode result of the compaction of node
public static StringGraphNode<?> compact(StringGraphNode<?> node) {
        if (node == null)
            return null;
        StringGraphNode<?> newNode = deepClone(node);
        if (newNode != null) {
            int hash;
            do {
                hash = newNode.hashCode();
                newNode = compactAux(newNode);
            } while (newNode != null && !(newNode.hashCode() == hash));
            return newNode;
        } else {
            return null;
        }
    }
public static StringGraphNode < ? > compact ( StringGraphNode < ? > node ) { if ( node == null ) return null ; StringGraphNode < ? > newNode = deepClone ( node ) ; if ( newNode != null ) { int hash ; do { hash = newNode . hashCode ( ) ; newNode = compactAux ( newNode ) ; } while ( newNode != null && ! ( newNode . hashCode ( ) == hash ) ) ; return newNode ; } else { return null ; } }
Type graph compaction algorithm, taken from
 <a href="https://lirias.kuleuven.be/bitstream/123456789/132040/1/cw108.pdf">
     Deriving descriptions of possible values of program variables by means of abstract interpretation: definitions and proofs.
Type graph compaction algorithm taken from <a href = " https : // lirias . kuleuven . be / bitstream / 123456789 / 132040 / 1 / cw108 . pdf " > Deriving descriptions of possible values of program variables by means of abstract interpretation : definitions and proofs .