def save_graphlet_document(gexf_fh, gidx, num_graphlets, samplesize,
    cooccurence_corpus):
    """Saves the induced graphlet patterns into dataset folder, it is only used in conjunction
    with graphlet_corpus()

    Parameters
    ----------
    gexf_fh : str
        path to gexf file of graph
    gidx : int
        integer id of the graph, typically matches number in 
        gexf_fh, if using TU Dortmund benchmark datasets
    num_graphlets : int
        size of graphlet patterns induced
    samplesize : int
        number of graphlet patterns sampled from graph
    cooccurrence_corpus : list
        list of graphlet patterns induced under cooccurrence 
        rules, in this case all graphlets immediately adjacent
        to an induced graphlet pattern.

    Returns
    -------
    None : None
        The decomposition algorithm will induce graphlet patterns for graphs
        recording the dataset/"global" vocabulary of patterns within a dictionary.
        The graph and its associated patterns (by IDs given through our hash function)
        are saved into a  <graphid>.wldr<depth> file which contains a line delimited
        list of all the substructure pattern ids.


    """
    open_fname = gexf_fh + '.graphlet' + '_ng_' + str(num_graphlets
        ) + '_ss_' + str(samplesize)
    with open(open_fname, 'w') as fh:
        for graphlet_neighbourhood in cooccurence_corpus:
            sentence = str.join(' ', map(str, graphlet_neighbourhood))
            print(sentence, file=fh)
