Get startedGet started for free

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.

This exercise is part of the course

Graph RAG with LangChain and Neo4j

View Course

Exercise instructions

  • Create a new node of type "Book" with the unique identifier building-knowledge-graphs.

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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)
Edit and Run Code