<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package etomica.graph.operations;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import etomica.graph.iterators.IteratorWrapper;
import etomica.graph.iterators.filters.IdenticalGraphFilter;
import etomica.graph.model.Graph;
import etomica.graph.model.impl.CoefficientImpl;
import etomica.graph.property.Property;

/**
 * Returns all graphs that are isomorphs of the original graph(s).  Optionally,
 * condense graphs that are identical.
 *
 * @author <NAME>
 */
public class AllIsomorphs implements Unary {

  public Set<Graph> apply(Set<Graph> argument, Parameters params) {
    assert (params instanceof AllIsomorphsParameters);
    Set<Graph> result = new HashSet<Graph>();
    for (Graph g : argument) {
      result.addAll(apply(g, (AllIsomorphsParameters)params));
    }
    return result;
  }

  public Set<Graph> apply(Graph g, AllIsomorphsParameters params) {
    Set<Graph> result = new HashSet<Graph>();
    result.add(g.copy());
    if (g.nodeCount() < 2) {
      return result;
    }
    byte nodeCount = g.nodeCount();<commit_msg>impose propertyFilter on first graph<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package etomica.graph.operations;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import etomica.graph.iterators.IteratorWrapper;
import etomica.graph.iterators.filters.IdenticalGraphFilter;
import etomica.graph.model.Graph;
import etomica.graph.model.impl.CoefficientImpl;
import etomica.graph.property.Property;

/**
 * Returns all graphs that are isomorphs of the original graph(s).  Optionally,
 * condense graphs that are identical.
 *
 * @author <NAME>
 */
public class AllIsomorphs implements Unary {

  public Set<Graph> apply(Set<Graph> argument, Parameters params) {
    assert (params instanceof AllIsomorphsParameters);
    Set<Graph> result = new HashSet<Graph>();
    for (Graph g : argument) {
      result.addAll(apply(g, (AllIsomorphsParameters)params));
    }
    return result;
  }

  public Set<Graph> apply(Graph g, AllIsomorphsParameters params) {
    Set<Graph> result = new HashSet<Graph>();
    if (params.propertyFilter == null || params.propertyFilter.check(g)) result.add(g.copy());
    if (g.nodeCount() < 2) {
      return result;
    }
    byte nodeCount = g.nodeCount();
{'fraction_non_alphanumeric': 0.11239731142643763, 'fraction_numerical': 0.0037341299477221808, 'mean_word_length': 4.073863636363637, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3015867', 'n_tokens_mistral': 829, 'n_tokens_neox': 814, 'n_words': 241}