hey - any help would be appreciated.
I was trying out
https://docs.llamaindex.ai/en/stable/examples/property_graph/property_graph_nebula/, and I was running into an issue as I wanted to visualize the traversed graph as in the image. The retriever only gets the nodes. Here is a gist
https://gist.github.com/flight505/6a3c0311706aebea301d02bc74a763a8 where I attempted to run it in streamlit, hoping to use LlamaIndex traversal method, but it does not work for paths. Is there a simple direct method that I could use from Llmmaindex? - I haven't found it in the docs
the basic code should be something like this, here i can get the nodes used in the query but not the paths:
if st.button("Query Engine"):
if query:
query_engine = index.as_query_engine(include_text=True)
try:
response = query_engine.query(query)
st.write("Query Response:")
st.write(str(response)) # Print the response to inspect its structure
# Extract nodes and edges from the response
nodes = [{"id": node.node_id, "name": node.text} for node in response.nodes]
edges = [{"source": edge.start_node_id, "target": edge.end_node_id, "relationship": edge.relationship} for edge in response.edges]
# Visualize the graph
net = visualize_graph(nodes, edges)
display_graph(net)
except Exception as e:
st.error(f"Error during query: {str(e)}")