def _analyze(graph):
    # Get the walk object
    w_obj = polygraph.walk_classes(graph)

    # Solve the linear system involving the eig_matrix
    res = polygraph.positive_linear_system_check(w_obj)

    # Check to see if x is positive
    return np.all(res.x >= 0)
}


pyramid = gen.pyramid_prism(4, 0)


pwff = []
acff = []
classes = []
for graph_type, generator in GRAPHS.items():
    pwrow = [graph_type]
    acrow = [graph_type]
    crow = [graph_type]
    for i in range(MIN, MAX_1):
        graph = nx.cartesian_product(pyramid, generator(i))
        w_obj = polygraph.walk_classes(graph)
        w = w_obj['eig_matrix']
        pwrow.append(polygraph.pair_wise_flip_flopping(w))
        acrow.append(polygraph.average_condition_flip_flopping(w))
        crow.append(w_obj['num_classes'])
    pwff.append(pwrow)
    acff.append(acrow)
    classes.append(crow)

print('Number of Walk Classes')
print(tabulate(
    classes,
    tablefmt='grid',
    headers=['Graph', *[i for i in range(MIN, MAX_1)]]
))
print('Pair-Wise Flip-Flopping')
for name, generator in graphs_generators:

    logger.info('Analyzing graph {}'.format(name))

    # Construct graph
    logger.info('Generating graph')
    g = generator()

    # Analyze walk classes
    logger.info('Analyzing walk classes')
    if type(g) is dict:
        graph = g['graph']
        w_obj = polygraph.spider_torus_walk_classes(g)
    else:
        graph = g
        w_obj = polygraph.walk_classes(g, max_power=MAX_POWER)

    # Generate solutions to nonnegative linear system
    logger.info('Performing nonnegative system check')
    res = polygraph.nonnegative_linear_system_check(w_obj)

    # Check for success
    if not res.success:
        logger.warning('Failed nonnegative check on {} with {}'.format(
            name,
            res.message
        ))
    else:
        # Take solutions as coefficients
        coefficients = res.x[::-1]