<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Connections between MKs
**MK = Member of the knesset  (חבר כנסת)
Based on transcripts of the knesset committees.<br/>
The work was done in the 'public knowledge workshop' hackathon and won 3rd place prize.
Step1:  Degree of node
Step2:  The MKs with the highest total degree
Step3:  We can see that these are mostly the head of the committees, which makes sense.. <br/>Let's remove them
Step4:  The MKs with the highest in degree
The mks that are spoken to the most
Step5:  Without head of the committees
Step6:  The MKs with the highest in degree
The mks that speaks to others the most
Step7:  The MKs with the highest centrality
The most central mks
Step8:  Who did I talk to/about
Step9:  Benjamin Netanyahu doesn't attend the Knesset committees and even if he do he only talks to Yuli Edelstein.
Who talked about me
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import networkx as nx
import matplotlib
import warnings
import matplotlib.pyplot as plt
warnings.filterwarnings('ignore')
%matplotlib inline
plt.rcParams["figure.figsize"] = (15,15)
G = nx.read_gml('./Mk_connections_graph')
G.remove_node('האירק')
#Reverting the Mks names since hebrew is printed reversed :)
def reverse(some_list):
    return [item[::-1] for item in some_list]
def print_reversed(dictionary):
    return [(key[::-1] , value) for (key, value) in sorted(dictionary.items() ,key=lambda x: x[1] ,reverse=True)]
    
heads_of_committees = set(['מיקי זוהר', 'משה גפני', 'איתן כבל'
                       ,'אבי דיכטר', 'יואב קיש', 'דוד ביטן', 'צחי הנגבי',
                       'דוד אמסלם', 'ניסן סלומינסקי', 'אברהם נגוסה', 'יעקב מרגי',
                       'אלי אלאלוף' ,'שלי יחימוביץ' ,'עאידה תומא סלימאן',
                      'קארין אלהרר', 'אורי מקלב', 'יצחק וקנין', 'איל בן ראובן'])
def without_committee_heads(mks_list):
    return [(mk,d) for (mk,d) in mks_list if mk not in heads_of_committees_reversed]
pos = nx.spring_layout(G, k=1, scale=10000)
def draw_graph(G, arrows=False):
    nx.draw_networkx_nodes(G, pos)
    nx.draw_networkx_labels(G, pos, font_size=16)
    weights = set([])
    for n1,n2 in G.edges():
        weight = G.get_edge_data(n1,n2)['weight']
        weights.add(weight)
    for weight in weights:
        edges_with_weight = [edge for edge in G.edges() if weight == G.get_edge_data(*edge)['weight']]
        nx.draw_networkx_edges(G, pos, edgelist=edges_with_weight, width=weight, arrows=arrows, edge_color='b', arrow_style='->')
draw_graph(G)
Explanation: Connections between MKs
**MK = Member of the knesset  (חבר כנסת)
Based on transcripts of the knesset committees.<br/>
The work was done in the 'public knowledge workshop' hackathon and won 3rd place prize.
End of explanation
def reverse(some_list):
    return [item[::-1] for item in some_list]
def print_reversed(dictionary):
    dictionary = dict(dictionary)
    return [(key[::-1] , value) for (key, value) in sorted(dictionary.items() ,key=lambda x: x[1] ,reverse=True)]
Explanation: Degree of node:
End of explanation
print_reversed(G.degree())[:10]
Explanation: The MKs with the highest total degree
End of explanation
without_committee_heads(print_reversed(G.degree()))[:10]
Explanation: We can see that these are mostly the head of the committees, which makes sense.. <br/>Let's remove them
End of explanation
print_reversed(G.in_degree())[:10]
Explanation: The MKs with the highest in degree
The mks that are spoken to the most
End of explanation
without_committee_heads(print_reversed(G.in_degree()))[:10]
Explanation: Without head of the committees
End of explanation
print_reversed(G.out_degree())[:10]
without_committee_heads(print_reversed(G.out_degree()))[:10]
Explanation: The MKs with the highest in degree
The mks that speaks to others the most
End of explanation
print_reversed(nx.degree_centrality(G))[:10]
without_committee_heads(print_reversed(nx.degree_centrality(G)))[:10]
Explanation: The MKs with the highest centrality
The most central mks
End of explanation
def draw_out_subgraph_of_node(some_node, arrows=False):
    some_node = some_node[::-1]
    neighbors = list(G.neighbors(some_node))
    neighbors.append(some_node)
    draw_graph(G.subgraph(neighbors), arrows)
draw_out_subgraph_of_node('ראש הממשלה בנימין נתניהו')
draw_out_subgraph_of_node('בנימין נתניהו')
Explanation: Who did I talk to/about
End of explanation
def draw_in_subgraph_of_node(some_node, arrows=False):
    some_node = some_node[::-1]
    neighbors = list(G.to_undirected().neighbors(some_node))
    neighbors.append(some_node)
    draw_graph(G.subgraph(neighbors), arrows)
draw_in_subgraph_of_node('בנימין נתניהו')
Explanation: Benjamin Netanyahu doesn't attend the Knesset committees and even if he do he only talks to Yuli Edelstein.
Who talked about me
End of explanation
<END_TASK>