<jupyter_start><jupyter_text>Table of Contents<jupyter_code>import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
import numpy as np
from enm.enm import Enm
ba = nx.connected_watts_strogatz_graph(20,5,.5)
nx.draw(ba)
e_ba = Enm('ba')
e_ba.G = ba
e_ba.giant_component()
e_ba.gnm_analysis()
e_ba.get_prs(no_diag=False)
pos = nx.spring_layout(ba)
plt.style.use('default')
proj_prs_1 = e_ba.prs_mat[[np.argmax(e_ba.prs_mat.mean(axis=1))],:]#.mean(axis=0)
fig, ax = plt.subplots(nrows=3,ncols=1,figsize=(5,10),gridspec_kw={'height_ratios': [10,10, 1]})
plt.style.use('default')
proj_prs_2 = e_ba.prs_mat[:,np.argmax(e_ba.prs_mat.mean(axis=0))]#.mean(axis=0)

nx.draw_networkx_nodes(ba,pos=pos, node_color=proj_prs_1, cmap=plt.cm.coolwarm,ax=ax[0],edgecolors='black',vmin=0,vmax=0.3)
nx.draw_networkx_nodes(nx.induced_subgraph(ba,np.argmax(e_ba.prs_mat.mean(axis=1))),pos=pos, node_color='red',cmap=plt.cm.coolwarm,ax=ax[0],edgecolors='black',vmin=0,vmax=2.5,node_shape='s')
nx.draw_networkx_edges(ba,pos=pos,ax=ax[0],alpha=0.5)

nx.draw_networkx_nodes(ba,pos=pos, node_color=proj_prs_2,cmap=plt.cm.coolwarm,ax=ax[1],edgecolors='black',vmin=0,vmax=.3, node_shape='s')
nx.draw_networkx_nodes(nx.induced_subgraph(ba,np.argmax(e_ba.prs_mat.mean(axis=0))),pos=pos, node_color='red',cmap=plt.cm.Greens,ax=ax[1],edgecolors='black',vmin=0,vmax=2.5)
nx.draw_networkx_edges(ba,pos=pos,ax=ax[1],alpha=0.5)

# Turn these into an object that can be used to map time values to colors and
# can be passed to plt.colorbar().
cpick = plt.cm.ScalarMappable(norm=None,cmap=plt.cm.coolwarm)
cpick.set_array([])



#F = plt.figure()
#A = fig.add_subplot(111)
#for y, t in zip(ydat,tim):
#    A.plot(xdat,y,color=cpick.to_rgba(t))

plt.colorbar(cpick,label="Propagation level",cax=ax[2],orientation='horizontal')

plt.tight_layout()

plt.savefig('../reports/figures/paper_figures_0423_pcc_only/random_propagation_vertical.pdf')
plt.style.use('default')

fig, ax = plt.subplots(nrows=1,ncols=3,figsize=(10,5),gridspec_kw={'width_ratios': [10,10, 1]})
plt.style.use('default')
proj_prs_2 = e_ba.prs_mat[:,np.argmin(e_ba.prs_mat.mean(axis=0))]#.mean(axis=0)

nx.draw_networkx_nodes(ba,pos=pos, node_color=proj_prs_2, cmap=plt.cm.coolwarm,ax=ax[1],edgecolors='black',vmin=0,vmax=1.5)
nx.draw_networkx_nodes(nx.induced_subgraph(ba,np.argmin(e_ba.prs_mat.mean(axis=0))),pos=pos, node_color='red',cmap=plt.cm.Greens,ax=ax[1],edgecolors='black',vmin=0,vmax=.5)
nx.draw_networkx_edges(ba,pos=pos,ax=ax[1],alpha=0.5)
ax[0].set_xlabel('Most sensitive')
ax[1].set_xlabel('Least sensitive')
cpick = plt.cm.ScalarMappable(norm=None,cmap=plt.cm.coolwarm)
cpick.set_array([])
plt.colorbar(cpick,label="Propagation level",cax=ax[2])
plt.tight_layout()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19006166122597026, 'fraction_numerical': 0.029379760609358, 'mean_word_length': 9.731517509727626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '421593', 'license': 'MIT', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1258, 'n_words': 120, 'path': 'notebooks/21-random_graph_figures-051021.ipynb', 'repo_name': 'SHZ66/enm_package', 'size': '2757'}