def draw_top_compare():
    """ Plot results of top_compare
    """

    ifname = "data/mesos0825_s0dot2/mesos0825_s0dot2_stat"

    res = []
    for line in open(ifname):
        group, kn, mesos_sim, motif_supp, mesos, motif = line.strip("\r\n").split("\t")

        mesos = loads_mobgraph(mesos)
        motif = loads_mobgraph(motif)
        res.append((int(group), int(kn), float(mesos_sim), float(motif_supp), mesos, motif))

    ncol = 5
    nrow = np.ceil(1.0 * len(res) / ncol)

    plt.figure(figsize=(20, 40))
    for i in range(len(res)):
        motif = res[i][5]
        supp = res[i][3]
        plt.subplot(nrow, ncol, i + 1)
        draw_networkx(motif)
        plt.title("%.1f%%, nn=%d" % (supp * 100, motif.number_of_nodes()))

    plt.savefig("figures/mesos0825_s0.2_top_motif.pdf")
def draw_top_compare():
    """ Plot results of top_compare
    """

    ifname = 'data/mesos0825_s0dot2/mesos0825_s0dot2_stat'

    res = []
    for line in open(ifname):
        group, kn, mesos_sim, motif_supp, mesos, motif = line.strip(
            '\r\n').split('\t')

        mesos = loads_mobgraph(mesos)
        motif = loads_mobgraph(motif)
        res.append((int(group), int(kn), float(mesos_sim), float(motif_supp),
                    mesos, motif))

    ncol = 5
    nrow = np.ceil(1.0 * len(res) / ncol)

    plt.figure(figsize=(20, 40))
    for i in range(len(res)):
        motif = res[i][5]
        supp = res[i][3]
        plt.subplot(nrow, ncol, i + 1)
        draw_networkx(motif)
        plt.title('%.1f%%, nn=%d' % (supp * 100, motif.number_of_nodes()))

    plt.savefig('figures/mesos0825_s0.2_top_motif.pdf')
def loads_mesos(S):
    return loads_mobgraph(S)
def loads_mesos(S):
    return loads_mobgraph(S)