spin.py
def parse_data(lines):
    """
    Seperates and organizes raw data extracted from data file.
    Args:
        lines: list of system data from get_data function.
    Returns:
        node_qty: an integer denoting quantity of nodes in the system.
        weights: list of tuples of nodes, edges and respective weights for the system.
    """
    weights = []
    for l in lines: # Iterative through list of lines saved from data file.
        if l[0] == str('c'): # Skips comments, lines with a first character 'c'.
            continue
        elif l[0] == str('p'): # Identifes 'p' line which includes qty values for nodes and weights.
            p = l.split(' ') # Formats and saves'p' line data to a list.
            node_qty = int(p[2])
        else:
            weights.append(tuple(map(int, l.split()))) # Formats and saves weights from lines list.
            
    return (node_qty, weights)

    Seperates and organizes raw data extracted from data file.
    Args:
        lines: list of system data from get_data function.
    Returns:
        node_qty: an integer denoting quantity of nodes in the system.
        weights: list of tuples of nodes, edges and respective weights for the system.
    
Seperates and organizes raw data extracted from data file.
Seperates and organizes raw data extracted from data file .
def parse_data(lines):
    weights = []
    for l in lines: 
        if l[0] == str('c'): 
            continue
        elif l[0] == str('p'): 
            p = l.split(' ') 
            node_qty = int(p[2])
        else:
            weights.append(tuple(map(int, l.split()))) 
    return (node_qty, weights)
def parse_data ( lines ) : weights = [ ] for l in lines : if l [ 0 ] == str ( 'c' ) : continue elif l [ 0 ] == str ( 'p' ) : p = l . split ( ' ' ) node_qty = int ( p [ 2 ] ) else : weights . append ( tuple ( map ( int , l . split ( ) ) ) ) return ( node_qty , weights )
Seperates and organizes raw data extracted from data file.
Seperates and organizes raw data extracted from data file .
"""
    Seperates and organizes raw data extracted from data file.
    Args:
        lines: list of system data from get_data function.
    Returns:
        node_qty: an integer denoting quantity of nodes in the system.
        weights: list of tuples of nodes, edges and respective weights for the system.
    """ # Iterative through list of lines saved from data file. # Skips comments, lines with a first character 'c'. # Identifes 'p' line which includes qty values for nodes and weights. # Formats and saves'p' line data to a list. # Formats and saves weights from lines list.
an integer denoting quantity of nodes in the system.
weights: list of tuples of nodes, edges and respective weights for the system.
an integer denoting quantity of nodes in the system . weights : list of tuples of nodes edges and respective weights for the system .
node_qty
lines
list of system data from get_data function.
list of system data from get_data function .