fairness_instru.py
def visualize(nested_graph, log_list, save_path, dag_save):
    """
    Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph.

    args:
        nested_graph: graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph. List.
        log_list: log_list storing all operation identifiers. List.
        save_path: path used for saving DAG. String.
        dag_save: format of DAG to be saved. String.

    return:
        dot: graphviz DAG object.
        rand_rgb: color list storing the sequence of color used for DAG nodes.
    """
    no_nodes = len(log_list)
    rand_rgb = ['#191970', '#ff0000', '#006400', '#32cd32', '#ffd700', '#9932cc', '#ff69b4', '#8b4513', '#00ced1', '#d2691e'] if no_nodes <= 10 else ["#"+''.join([random.choice('0123456789ABCDEF') for j in range(6)]) for i in range(no_nodes)]
    dot = Digraph(comment='preprocessing_pipeline')
    dot.format = dag_save
    previous = {}
    for i, node in enumerate(nested_graph):
        node_name = node.name.replace('>=', '&ge;').replace('<=', '&le;')[:50] +' ...' if len(node.name)>40 else node.name.replace('>=', '&ge;').replace('<=', '&le;')
        dot.node(node.name, color = rand_rgb[i], fontcolor = rand_rgb[i], href = "{{url_for('home', type="+str(log_list[i])+")}}", label = f'''<<font POINT-SIZE="14"><b>{node_name}</b></font><br/><font POINT-SIZE="10">{node.operation}</font>>''')
        # dot.node(node.name, color = rand_rgb[i], fontcolor = rand_rgb[i], href = "{{url_for('home', type="+str(log_list[i])+")}}", label = f"{node.name}\n{node.operation}")
        parents = node.parent_vertices

        for parent in parents:
            dot.edge(parent.name, node.name)

    if not os.path.exists(save_path+'/DAG'):
        os.mkdir(save_path+'/DAG')
    dot.render(save_path+'/DAG/pipeline', view=False)
    return dot, rand_rgb

    Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph.

    args:
        nested_graph: graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph. List.
        log_list: log_list storing all operation identifiers. List.
        save_path: path used for saving DAG. String.
        dag_save: format of DAG to be saved. String.

    return:
        dot: graphviz DAG object.
        rand_rgb: color list storing the sequence of color used for DAG nodes.
    
Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph.

graphviz DAG object.
rand_rgb: color list storing the sequence of color used for DAG nodes.
Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph . graphviz DAG object . rand_rgb : color list storing the sequence of color used for DAG nodes .
def visualize(nested_graph, log_list, save_path, dag_save):
    no_nodes = len(log_list)
    rand_rgb = ['#191970', '#ff0000', '#006400', '#32cd32', '#ffd700', '#9932cc', '#ff69b4', '#8b4513', '#00ced1', '#d2691e'] if no_nodes <= 10 else ["#"+''.join([random.choice('0123456789ABCDEF') for j in range(6)]) for i in range(no_nodes)]
    dot = Digraph(comment='preprocessing_pipeline')
    dot.format = dag_save
    previous = {}
    for i, node in enumerate(nested_graph):
        node_name = node.name.replace('>=', '&ge;').replace('<=', '&le;')[:50] +' ...' if len(node.name)>40 else node.name.replace('>=', '&ge;').replace('<=', '&le;')
        dot.node(node.name, color = rand_rgb[i], fontcolor = rand_rgb[i], href = "{{url_for('home', type="+str(log_list[i])+")}}", label = f'''<<font POINT-SIZE="14"><b>{node_name}</b></font><br/><font POINT-SIZE="10">{node.operation}</font>>''')
        parents = node.parent_vertices
        for parent in parents:
            dot.edge(parent.name, node.name)
    if not os.path.exists(save_path+'/DAG'):
        os.mkdir(save_path+'/DAG')
    dot.render(save_path+'/DAG/pipeline', view=False)
    return dot, rand_rgb
def visualize ( nested_graph , log_list , save_path , dag_save ) : no_nodes = len ( log_list ) rand_rgb = [ '#191970' , '#ff0000' , '#006400' , '#32cd32' , '#ffd700' , '#9932cc' , '#ff69b4' , '#8b4513' , '#00ced1' , '#d2691e' ] if no_nodes <= 10 else [ "#" + '' . join ( [ random . choice ( '0123456789ABCDEF' ) for j in range ( 6 ) ] ) for i in range ( no_nodes ) ] dot = Digraph ( comment = 'preprocessing_pipeline' ) dot . format = dag_save previous = { } for i , node in enumerate ( nested_graph ) : node_name = node . name . replace ( '>=' , '&ge;' ) . replace ( '<=' , '&le;' ) [ : 50 ] + ' ...' if len ( node . name ) > 40 else node . name . replace ( '>=' , '&ge;' ) . replace ( '<=' , '&le;' ) dot . node ( node . name , color = rand_rgb [ i ] , fontcolor = rand_rgb [ i ] , href = "{{url_for('home', type=" + str ( log_list [ i ] ) + ")}}" , label = f'''<<font POINT-SIZE="14"><b>{node_name}</b></font><br/><font POINT-SIZE="10">{node.operation}</font>>''' ) parents = node . parent_vertices for parent in parents : dot . edge ( parent . name , node . name ) if not os . path . exists ( save_path + '/DAG' ) : os . mkdir ( save_path + '/DAG' ) dot . render ( save_path + '/DAG/pipeline' , view = False ) return dot , rand_rgb
Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph.
Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph .
"""
    Use graphvis to generate DAGs from graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph.

    args:
        nested_graph: graph list generated from pandas_to_dataflow_graph and sklearn_to_dataflow_graph. List.
        log_list: log_list storing all operation identifiers. List.
        save_path: path used for saving DAG. String.
        dag_save: format of DAG to be saved. String.

    return:
        dot: graphviz DAG object.
        rand_rgb: color list storing the sequence of color used for DAG nodes.
    """ # dot.node(node.name, color = rand_rgb[i], fontcolor = rand_rgb[i], href = "{{url_for('home', type="+str(log_list[i])+")}}", label = f"{node.name}\n{node.operation}")
nested_graph
log_list
save_path
dag_save