Creating nodes
Time to start storing information as graphs! To begin, you'll create a node to represent the book, Building Knowledge Graphs, a practitioner's guide to creating knowledge graphs in Neo4j.
We have provided a visualize_node() function to visualize the resulting graph using the matplotlib library.
Cet exercice fait partie du cours
Graph RAG with LangChain and Neo4j
Instructions
- Create a new node of type
"Book"with the unique identifierbuilding-knowledge-graphs.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
from langchain_neo4j.graphs.graph_document import Node
# Create a Book node with a unique identifier
book = ____(
____="____",
____="____",
properties={"title": "Building Knowledge Graphs"}
)
print(book.id, book.type, book.properties['title'])
visualize_node(book)