Unwanted nodes and edges while plotting nebula knowledge graph using pyvis

58 views Asked by At

Context:

We created a graph index using llama-index on our own custom documents. Triplets were created and stored in the Nebula graph DB.

We used the following snippet (taken from llama-index official documentation) to plot the knowledge graph for only 2 nodes (or entities) using pyvis:

from pyvis.network import Network
from IPython.display import display

from indexing import get_graph_index_for_document

kg_index = get_graph_index_for_document(index_id="b43c9a68-7e7a-48ce-8caa-736ed9730b95", domain_name="bp")
g = kg_index.get_networkx_graph(limit=2)
net = Network(notebook=False, cdn_resources="in_line", directed=True)
net.from_nx(g)
net.show("graph.html")

And we received the following result:

enter image description here

My Question:

Q1) From where did the other nodes and edges come from?

What did I try?

I manually checked the contents of the graph index, and everything seems to be fine. It just stores the entities, the entity relationships, and the respective embeddings.

It seems that pyvis is adding something here or Q2) Am I missing something / doing wrong here?

0

There are 0 answers