Skip to content

Instantly share code, notes, and snippets.

View shubham-singh-ss's full-sized avatar

Shubham Singh shubham-singh-ss

View GitHub Profile
df = pd.read_csv(r"train.csv")
df.head()
import json
import os
import numpy as np
import tensorflow as tf
import model, sample, encoder
import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figsize=(12,8))
nx.draw_networkx(df, with_labels=True)
from networkx.algorithms import tree
minspantree = tree.minimum_spanning_edges(df, algorithm='kruskal', data=False)
elist = list(minspantree)
sorted(sorted(e) for e in elist)
from networkx.algorithms import tree
minspantree = tree.minimum_spanning_edges(df, algorithm='prim', data=False)
elist = list(minspantree)
sorted(sorted(e) for e in elist)
nx.betweenness_centrality(df)
nx.degree_centrality(df)
nx.closeness_centrality(df)
pr = nx.pagerank(df, alpha=0.9)
pr
shortest_path_distance = nx.dijkstra_path(df, source='AMA', target='PBI', weight='Distance')
shortest_path_distance