# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import xetrapal, pandas
from xetrapal import gdastras
a=xetrapal.karma.load_xpal_smriti("/opt/xpal-data//avxpal.json")
avxpal=xetrapal.Xetrapal(a)
config=xetrapal.karma.load_config_json(a.configfile)
pygsheetsconfig = xetrapal.karma.load_config_json(config['Pygsheets']['avdrive'])
gd = gdastras.gd_get_googledriver(pygsheetsconfig)


# +
gd.spreadsheet_titles()


# -

ndhmgraph = gd.open("NDHM Graph")
#rels=ndhmgraph.work

edgesheet=ndhmgraph.worksheet_by_title("edges")
nodesheet=ndhmgraph.worksheet_by_title("nodes")

edges = edgesheet.get_as_df(include_tailing_empty=False)
edges
# nodes = nodesheet.get_as_df(include_tailing_empty=False).dropna()

# +

p=pandas.DataFrame()
p['id']=pandas.array(list(set(list(edges.source.unique())+list(edges.target.unique()))))
nodesheet.set_dataframe(p,(1,1))
# -

import d3fdgraph
d3fdgraph.plot_force_directed_graph(edges[["source", "target", "weight"]], link_width_scale=10,node_radius=10)







StarcoderdataJupyterScriptsDedupFiltered