GNN-Knowledge-Graph / view_db.py
SandhyaMadhunagula's picture
Upload 5 files
be89e03 verified
raw
history blame contribute delete
316 Bytes
import pickle
import pandas as pd
with open("graph_database.pkl", "rb") as f:
G = pickle.load(f)
# Convert edges to a list of dictionaries
edge_list = [{"Subject": s, "Relation": d['label'], "Object": t} for s, t, d in G.edges(data=True)]
# Display as a table
df = pd.DataFrame(edge_list)
print(df)