Class GraphTransformUtil


  • public class GraphTransformUtil
    extends Object
    • Method Detail

      • replaceSubgraphsMatching

        public static SameDiff replaceSubgraphsMatching​(@NonNull
                                                        @NonNull SameDiff sd,
                                                        @NonNull
                                                        @NonNull SubGraphPredicate p,
                                                        @NonNull
                                                        @NonNull SubGraphProcessor processor)
        Find all of the subgraphs that match the specified SubGraphPredicate and then replace them with a different subgraph.
        Note that the original SameDiff instance is not modified; a copy is made, which is then modified and returned.
        Note: For each subgraph to be replaced by SubGraphProcessor, its replacement should have the same number of output SDVariables.
        Parameters:
        sd - SameDiff instance to copy and modify
        p - SubGraphPredicate to define and select the subgraphs that should be modified or replaced
        processor - SubGraphProcessor is used to define how the subgraphs (selected by the SubGraphPredicate) should be modified/replaced
        Returns:
        A SameDiff instance that has been modified
      • getSubgraphsMatching

        public static List<SubGraph> getSubgraphsMatching​(SameDiff sd,
                                                          SubGraphPredicate p)
        Get a list of all the subgraphs that match the specified predicate
        Parameters:
        sd - SameDiff instance to get the subgraphs for
        p - Subgraph predicate. This defines the subgraphs that should be selected in the SameDiff instance
        Returns:
        Subgraphs