def calculate_average_scores_on_subgraphs(<EOL>subgraphs: Mapping[H, BELGraph],<EOL>key: Optional[str] = None,<EOL>tag: Optional[str] = None,<EOL>default_score: Optional[float] = None,<EOL>runs: Optional[int] = None,<EOL>use_tqdm: bool = False,<EOL>tqdm_kwargs: Optional[Mapping[str, Any]] = None,<EOL>) -> Mapping[H, Tuple[float, float, float, float, int, int]]:
results = {}<EOL>log.info('<STR_LIT>', len(subgraphs), runs)<EOL>it = subgraphs.items()<EOL>if use_tqdm:<EOL><INDENT>_tqdm_kwargs = dict(total=len(subgraphs), desc='<STR_LIT>')<EOL>if tqdm_kwargs:<EOL><INDENT>_tqdm_kwargs.update(tqdm_kwargs)<EOL><DEDENT>it = tqdm(it, **_tqdm_kwargs)<EOL><DEDENT>for node, subgraph in it:<EOL><INDENT>number_first_neighbors = subgraph.in_degree(node)<EOL>number_first_neighbors = <NUM_LIT:0> if isinstance(number_first_neighbors, dict) else number_first_neighbors<EOL>mechanism_size = subgraph.number_of_nodes()<EOL>runners = workflow(subgraph, node, key=key, tag=tag, default_score=default_score, runs=runs)<EOL>scores = [runner.get_final_score() for runner in runners]<EOL>if <NUM_LIT:0> == len(scores):<EOL><INDENT>results[node] = (<EOL>None,<EOL>None,<EOL>None,<EOL>None,<EOL>number_first_neighbors,<EOL>mechanism_size,<EOL>)<EOL>continue<EOL><DEDENT>scores = np.array(scores)<EOL>average_score = np.average(scores)<EOL>score_std = np.std(scores)<EOL>med_score = np.median(scores)<EOL>chi_2_stat, norm_p = stats.normaltest(scores)<EOL>results[node] = (<EOL>average_score,<EOL>score_std,<EOL>norm_p,<EOL>med_score,<EOL>number_first_neighbors,<EOL>mechanism_size,<EOL>)<EOL><DEDENT>return results<EOL>
Calculate the scores over precomputed candidate mechanisms.

    :param subgraphs: A dictionary of keys to their corresponding subgraphs
    :param key: The key in the node data dictionary representing the experimental data. Defaults to
     :data:`pybel_tools.constants.WEIGHT`.
    :param tag: The key for the nodes' data dictionaries where the scores will be put. Defaults to 'score'
    :param default_score: The initial score for all nodes. This number can go up or down.
    :param runs: The number of times to run the heat diffusion workflow. Defaults to 100.
    :param use_tqdm: Should there be a progress bar for runners?
    :return: A dictionary of keys to results tuples

    Example Usage:

    >>> import pandas as pd
    >>> from pybel_tools.generation import generate_bioprocess_mechanisms
    >>> from pybel_tools.analysis.heat import calculate_average_scores_on_subgraphs
    >>> # load graph and data
    >>> graph = ...
    >>> candidate_mechanisms = generate_bioprocess_mechanisms(graph)
    >>> scores = calculate_average_scores_on_subgraphs(candidate_mechanisms)
    >>> pd.DataFrame.from_items(scores.items(), orient='index', columns=RESULT_LABELS)