mossnet package

MossNet is a Python library for performing network analyses on MOSS results

Module contents

mossnet.build(moss_results_links, verbose=False)[source]

Download MOSS results into a MossNet object

Args:

moss_results_links (list): A list of MOSS result URLs

verbose (bool): True to show verbose messages, otherwise False

Returns:

MossNet: A MossNet object

mossnet.load(mossnet_file)[source]

Load a MossNet object from file

Args:

mossnet_file (str): The desired input file

Returns:

MossNet: The resulting MossNet object

class mossnet.MossNet(moss_results_dict)[source]

Bases: object

export(outpath, style='html', gte=0, verbose=False)[source]

Export the links in this MossNet in the specified style

Args:

outpath (str): Path to desired output folder/file

style (str): Desired output style

gte (int): The minimum number of links for an edge to be exported

  • "dot" to export as a GraphViz DOT file

  • "gexf" to export as a Graph Exchange XML Format (GEXF) file

  • "html" to export one HTML file per pair

verbose (bool): True to show verbose messages, otherwise False

get_networkx()[source]

Return a NetworkX MultiDiGraph equivalent to this MossNet object

Returns:

MultiDiGraph: A NetworkX DiGraph equivalent to this MossNet object

get_nodes()[source]

Returns a set of node labels in this MossNet object

Returns:

set: The node labels in this MossNet object

get_pair(u, v, style='tuples')[source]

Returns the links between nodes u and v

Args:

u (str): A node label

v (str): A node label not equal to u

style (str): The representation of a given link

  • "tuples": Links are ((u_percent, u_html), (v_percent, v_html)) tuples

  • "html": Links are HTML representation (one HTML for all links)

  • "htmls": Links are HTML representations (one HTML per link)

Returns:

dict: The links between u and v (keys are filenames)

num_edges()[source]

Returns the number of (undirected) edges in this MossNet object (including parallel edges)

Returns:

int: The number of (undirected) edges in this MossNet object (including parallel edges)

Returns the number of links between u and v

Args:

u (str):

v (str):

Returns:

int: The number of links between u and v

num_nodes()[source]

Returns the number of nodes in this MossNet object

Returns:

int: The number of nodes in this MossNet object

outlier_pairs()[source]

Predict which student pairs are outliers (i.e., too many problem similarities). The distribution of number of links between student pairs (i.e., histogram) is modeled as y = A/(B^x), where x = a number of links, and y = the number of student pairs with that many links

Returns:

list of tuple: The student pairs expected to be outliers (in decreasing order of significance)

save(outfile)[source]

Save this MossNet object as a 3D dictionary of MOSS results

Args:

outfile (str): The desired output file’s path

traverse_pairs(order='descending')[source]

Iterate over student pairs

Args:

order (str): Order to sort pairs in iteration

  • None to not sort (may be faster for large/dense graphs)

  • "ascending" to sort in ascending order of number of links

  • "descending" to sort in descending order of number of links