cellyzer/visualization.py
def network_graph(edge_list, directed, gui, fig_id, font_size=6, users="All"):
    """
    Visualize the connections of the given list of users in a graph
    Nodes are users and Edges are the connections
    The arrow head from A to B represent a call from user A to B
    The edge value near the arrow head represents the number of calls made from A to B
    :param edge_list: list of 2 user couples with 1st user made a call to the 2nd
    :param directed: Bool value to switch between directed and undirected graphs
    :param fig_id: unique ID to the figure
    :param users: list of users
    :return: None, visualizes the graph in a web page
    """
    plt.figure(fig_id)
    if directed:
        g = nx.DiGraph()
    else:
        g = nx.Graph()
    for edge in edge_list:
        g.add_edge(edge[0], edge[1], weight=edge[2])

    pos = nx.circular_layout(g)
    labels = nx.get_edge_attributes(g, 'weight')
    nx.draw_networkx(g, pos, font_size=font_size, node_size=800, node_color="lightcoral", node_shape="o",
                     edge_color="dodgerblue", style="solid", width=2, )
    nx.draw_networkx_edge_labels(g, pos, edge_labels=labels, with_labels=True, font_size=font_size, label_pos=0.3)

    tmpfile = BytesIO()
    plt.title('Connections of : {}'.format(users), fontsize=8)
    plt.savefig(tmpfile, format='png')
    encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8')
    html = '<div>' + '<img src=\'data:image/png;base64,{}\'>'.format(encoded) + '</div>'
    with open('outputs\\connection_network.html', 'w') as f:
        f.write(html)
    webbrowser.open("outputs\\connection_network.html")

    Visualize the connections of the given list of users in a graph
    Nodes are users and Edges are the connections
    The arrow head from A to B represent a call from user A to B
    The edge value near the arrow head represents the number of calls made from A to B
    :param edge_list: list of 2 user couples with 1st user made a call to the 2nd
    :param directed: Bool value to switch between directed and undirected graphs
    :param fig_id: unique ID to the figure
    :param users: list of users
    :return: None, visualizes the graph in a web page
    
Visualize the connections of the given list of users in a graph
Nodes are users and Edges are the connections
The arrow head from A to B represent a call from user A to B
The edge value near the arrow head represents the number of calls made from A to B
Visualize the connections of the given list of users in a graph Nodes are users and Edges are the connections The arrow head from A to B represent a call from user A to B The edge value near the arrow head represents the number of calls made from A to B
def network_graph(edge_list, directed, gui, fig_id, font_size=6, users="All"):
    plt.figure(fig_id)
    if directed:
        g = nx.DiGraph()
    else:
        g = nx.Graph()
    for edge in edge_list:
        g.add_edge(edge[0], edge[1], weight=edge[2])
    pos = nx.circular_layout(g)
    labels = nx.get_edge_attributes(g, 'weight')
    nx.draw_networkx(g, pos, font_size=font_size, node_size=800, node_color="lightcoral", node_shape="o",
                     edge_color="dodgerblue", style="solid", width=2, )
    nx.draw_networkx_edge_labels(g, pos, edge_labels=labels, with_labels=True, font_size=font_size, label_pos=0.3)
    tmpfile = BytesIO()
    plt.title('Connections of : {}'.format(users), fontsize=8)
    plt.savefig(tmpfile, format='png')
    encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8')
    html = '<div>' + '<img src=\'data:image/png;base64,{}\'>'.format(encoded) + '</div>'
    with open('outputs\\connection_network.html', 'w') as f:
        f.write(html)
    webbrowser.open("outputs\\connection_network.html")
def network_graph ( edge_list , directed , gui , fig_id , font_size = 6 , users = "All" ) : plt . figure ( fig_id ) if directed : g = nx . DiGraph ( ) else : g = nx . Graph ( ) for edge in edge_list : g . add_edge ( edge [ 0 ] , edge [ 1 ] , weight = edge [ 2 ] ) pos = nx . circular_layout ( g ) labels = nx . get_edge_attributes ( g , 'weight' ) nx . draw_networkx ( g , pos , font_size = font_size , node_size = 800 , node_color = "lightcoral" , node_shape = "o" , edge_color = "dodgerblue" , style = "solid" , width = 2 , ) nx . draw_networkx_edge_labels ( g , pos , edge_labels = labels , with_labels = True , font_size = font_size , label_pos = 0.3 ) tmpfile = BytesIO ( ) plt . title ( 'Connections of : {}' . format ( users ) , fontsize = 8 ) plt . savefig ( tmpfile , format = 'png' ) encoded = base64 . b64encode ( tmpfile . getvalue ( ) ) . decode ( 'utf-8' ) html = '<div>' + '<img src=\'data:image/png;base64,{}\'>' . format ( encoded ) + '</div>' with open ( 'outputs\\connection_network.html' , 'w' ) as f : f . write ( html ) webbrowser . open ( "outputs\\connection_network.html" )
Visualize the connections of the given list of users in a graph
Nodes are users and Edges are the connections
The arrow head from A to B represent a call from user A to B
The edge value near the arrow head represents the number of calls made from A to B
Visualize the connections of the given list of users in a graph Nodes are users and Edges are the connections The arrow head from A to B represent a call from user A to B The edge value near the arrow head represents the number of calls made from A to B
"""
    Visualize the connections of the given list of users in a graph
    Nodes are users and Edges are the connections
    The arrow head from A to B represent a call from user A to B
    The edge value near the arrow head represents the number of calls made from A to B
    :param edge_list: list of 2 user couples with 1st user made a call to the 2nd
    :param directed: Bool value to switch between directed and undirected graphs
    :param fig_id: unique ID to the figure
    :param users: list of users
    :return: None, visualizes the graph in a web page
    """
None, visualizes the graph in a web page
None visualizes the graph in a web page
edge_list
list of 2 user couples with 1st user made a call to the 2nd
list of 2 user couples with 1st user made a call to the 2nd
directed
Bool value to switch between directed and undirected graphs
Bool value to switch between directed and undirected graphs
gui
fig_id
unique ID to the figure
unique ID to the figure
font_size
users
list of users
list of users