<commit_before>#coding: utf-8

import networkx
import random
import itertools
from collections import Counter


class VertexCoverDistCalculator(object):

    def _ok_check_values(self, check_values):
        for value in check_values:
            if value < 1:
                return False
        return True

    def vertex_cover_dist(self, G):
        n = G.number_of_nodes()
        constraint_graph = ConstraintGraph(G)
        ret_dist = Counter()

        for variable_values in itertools.product([0, 1], repeat=n):
            weight = sum(variable_values)
            check_values = constraint_graph.calc_check_values(variable_values)
            if self._ok_check_values(check_values):
                ret_dist[weight] += 1<commit_msg>グラフの次数分布を研鑽する関数の追加<commit_after>#coding: utf-8

import networkx
import random
import itertools
from collections import Counter


def degree_dist(G):
    return Counter(networkx.degree(G).values())


class VertexCoverDistCalculator(object):

    def _ok_check_values(self, check_values):
        for value in check_values:
            if value < 1:
                return False
        return True

    def vertex_cover_dist(self, G):
        n = G.number_of_nodes()
        constraint_graph = ConstraintGraph(G)
        ret_dist = Counter()

        for variable_values in itertools.product([0, 1], repeat=n):
            weight = sum(variable_values)
            check_values = constraint_graph.calc_check_values(variable_values)
            if self._ok_check_values(check_values):
                ret_dist[weight] += 1
{'fraction_non_alphanumeric': 0.07603833865814696, 'fraction_numerical': 0.006389776357827476, 'mean_word_length': 2.7197149643705463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6902398', 'n_tokens_mistral': 479, 'n_tokens_neox': 454, 'n_words': 105}