def run_motif_significance(graph, directed=True, data_loc="../data/", motif_size=3, n_shuffles=16, s_model='uncorrelated'): """Run z-score computation for all `motif_size` subgraph on the given `graph`. By default, graph is loaded as a directed graph_tool instance. Parameters ========== graph: name of the graph file.""" f_name = data_loc + graph + ".edges" g = load_graph_from_csv(f_name, directed, csv_options={ 'quotechar': '"', 'delimiter': ' ' }) m, z = motif_significance(g, motif_size, n_shuffles, shuffle_model=s_model) motif_annotation = str(motif_size) + 'm' if directed else str( motif_size) + 'um' output_name = "{}{}_{}.{}".format(data_loc, graph, motif_annotation, "motifslog") return write_motifs_results(output_name, m, z, n_shuffles, s_model)
def main(): with open("/home/usr8/15M54097/motifwalk/data/youtube_gt.data", "rb") as f: ytgt = pickle.load(f) yt_motif4_results = motif_significance(ytgt, k=4, n_shuffles=10, full_output=True) with open("./youtube_motif_results.pkl", "wb") as f: pickle.dump(yt_motif4_results, f) return 0
def motifs(g: Graph, k: int = 3): return clustering.motif_significance(g, k)