<jupyter_start><jupyter_text>Load tensor<jupyter_code>import spartan as st

# set the computing engine
st.config(st.engine.SINGLEMACHINE)

# load graph data, data stores as edgelist in database, e.g.~pandas, sqlite, postgress, hive
data = st.loadTensor(name="yelp", path="~/Data/", col_ids = ["uid", "oid", "rating"], col_types = [int, int, int])<jupyter_output><empty_output><jupyter_text>degree<jupyter_code># count degree
Du, Dv = st.bidegree(data)
# D = st.degree(data)<jupyter_output><empty_output><jupyter_text>Count triangles<jupyter_code># create triangle count model
trimodel = st.triangle_count.create(data, st.tc_policy.DOULION, "my_doulion_model")

 # run the model by default set undirected for graphs
trimodel.run(p=0.8)

 # show the results
trimodel.showResults(plot=True)<jupyter_output><empty_output><jupyter_text>Subgraph<jupyter_code>g = st.subgraph(data, A, B)
# g = st.subgraph(data, A)<jupyter_output><empty_output><jupyter_text>Eigen decomposition<jupyter_code># create a eigen decomposition model
edmodel = st.eigen_decompose.create(data, st.ed_policy.SVDS, "my_svds_model")

# run the model
edmodel.run(k=10)

# show the result
edmodel.showResults()<jupyter_output><empty_output><jupyter_text>Anomaly detection<jupyter_code># create a anomaly detection model
hsmodel = st.anomaly_detection.create(data, st.ad_policy.HOLOSCOPE, "my_holoscope_model")

 # run the model
hsmodel.run(k=3)

 # show the results
hsmodel.showResults()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12491559756920999, 'fraction_numerical': 0.00337609723160027, 'mean_word_length': 7.769230769230769, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '582022', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 573, 'n_tokens_neox': 551, 'n_words': 106, 'path': 'live-tutorials/graph_start.ipynb', 'repo_name': 'sunxiaobing1999/spartan2', 'size': '1481'}