Test demoΒΆ

This is to show one of the tests and its code

T_SFLU_DRFPMI_show_full()[source][github]

Show a graph reduction using networkx+tikz

code
def T_SFLU_DRFPMI_show_full():
    """
    Show a graph reduction using networkx+tikz
    """
    sflu = SFLU.SFLU(
        DRFPMI_edges,
        graph=True,
    )
    # match=False allows a reduced input/output set
    sflu.graph_nodes_pos(DRFPMI_locs, match=True)
    #sflu.graph_nodes_pos(DRFPMI_locs, match=True)
    print('inputs: ', sflu.inputs)
    print('outputs: ', sflu.outputs)
    print('nodes: ', sflu.nodes)

    #print('nodes')
    #print(sflu.graph_nodes_repr())
    G1 = sflu.G.copy()
    sflu.graph_reduce_auto_pos(lX=-10, rX=+10, Y=0, dY=-2)
    sflu.reduce(*reduce_list)
    sflu.graph_reduce_auto_pos_io(lX=-30, rX=+30, Y=-5, dY=-5)
    G2 = sflu.G.copy()

    nx2tikz.dump_pdf(
        [G1, G2],
        fname = tjoin('testG.pdf'),
        texname = tjoin('testG.tex'),
        # preamble = preamble,
        scale='10pt',
    )