<jupyter_start><jupyter_text>Dependencies: graph_stuff.py, numpy, networkx, pygraphviz<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import networkx as nx
import pygraphviz
import graph_stuff
import numpy as np
#token = None #put ADS token here
token = '<KEY>'
def get_cmst(start_bibcode):
    cgraph = graph_stuff.build_citation_graph(start_bibcode, token, depth=3)
    cmst = nx.algorithms.maximum_spanning_tree(cgraph)
    return cmst

def make_plot(cmst, savename=None):
    pubdates = np.asarray(list(nx.get_node_attributes(cmst, 'pubdate').values()))
    minpubdate = pubdates.min()
    maxpubdate = pubdates.max()
    def normalize(x):
        return (x - maxpubdate) / (maxpubdate - minpubdate)
    plt.figure(figsize=[16, 16])
    pos = nx.nx_agraph.graphviz_layout(cmst, prog='twopi', args='')
    plt.figure(figsize=(8, 8))
    nx.draw(cmst, pos, node_size=20, node_color=pubdates, 
            alpha=0.5, with_labels=False, cmap='rainbow')
    plt.axis('equal')
    if savename is not None:
        plt.savefig(savename)
cmst = get_cmst('2016ApJ...817..91B')
make_plot(cmst, savename='eg.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12836079791847355, 'fraction_numerical': 0.017346053772766695, 'mean_word_length': 4.6568627450980395, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '434639', 'license': 'MIT', 'n_tokens_mistral': 448, 'n_tokens_neox': 423, 'n_words': 83, 'path': 'example.ipynb', 'repo_name': 'dciampa/transitivecitation', 'size': '1188'}