<jupyter_start><jupyter_text>Week 5 Problem SetIn this problem set you will work with the dataset from Markov et al. shared by [<NAME> lab](http://core-nets.org/).First let's load up the data that we worked with in the Week 5 notebook, using a utility function that encapsulates much of the code from that notebook.  We will only use the data from the 29 target regions, since otherwise some of our analyses would be biased since it's not possible to find connections into a region that wasn't included as a target.<jupyter_code>import os,sys
import numpy,pandas
import networkx as nx

%matplotlib inline

sys.path.append('../utils')
from corenets import get_tract_graph
from utils import nx_to_igraph

# load the data with a very low threshold to remove sparse connections
# only use the target regions since otherwise analyses will be biased
G,adjacency_mtx=get_tract_graph(FLNe_threshold=10e-4,limit_to_target=True)<jupyter_output><empty_output><jupyter_text>Problem 1What proportion of possible single-step connections are present?  Treat a connection in either direction as positive evidence.<jupyter_code># INSERT SOLUTION HERE

print('proportion of single-step connections present:',prop_connected_1step)<jupyter_output>proportion of single-step connections present: 0.7931034482758621<jupyter_text>Problem 2a. What proportion of regions are connected by a directed path (regardless of the number of steps or the direction)?<jupyter_code># INSERT SOLUTION HERE

print('proportion of single-step connections present:',prop_connected_direct)<jupyter_output>proportion of single-step connections present: 1.0<jupyter_text>b. What is the mean path length for those direct connections?<jupyter_code># INSERT SOLUTION HERE

print('mean path length:',mean_direct_path_length)<jupyter_output>mean path length: 2.850985221674877<jupyter_text>Problem 3For regions that are connected by a single-step connection, what proportion of those regions have a bidirectional connection?<jupyter_code># INSERT SOLUTION HERE

print('Proportion of bidirectional single-step edges:',p_bidirectional)<jupyter_output>Proportion of bidirectional single-step edges: 0.6641221374045801
{'fraction_non_alphanumeric': 0.060536044362292055, 'fraction_numerical': 0.02911275415896488, 'mean_word_length': 6.732142857142857, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '445763', 'license': 'MIT', 'n_tokens_mistral': 688, 'n_tokens_neox': 593, 'n_words': 239, 'path': 'Week5-TractTracing/Pset_Week5.ipynb', 'repo_name': 'kdonbekci/brain-networks-course', 'size': '2173'}