Skip to content

Euler Graph Database

Euler Graph Database

Documentation Status License: MIT Python Version


Introduction to Euler Graph Database

The Euler Graph Database is a knowledge graph viewer that allows users to create, visualize, and manage knowledge graphs. It provides an interactive graphical user interface (GUI) for performing various operations on the knowledge graph such as adding nodes and edges, executing queries, and visualizing the graph. Additionally, it includes features like embedding, path finding, and tokenization that help you build a complete Graph-based Retrieval Augmented Generation (GraphRAG) system. You can also visualize the graphs directly from your terminal by typing eulerdb.

Features

  • Interactive GUI: A user-friendly interface for managing knowledge graphs.
  • Node and Edge Management: Easily add, edit, and delete nodes and edges in your graph.
  • Query Execution: Perform complex queries to retrieve and analyze graph data.
  • Graph Visualization: Visualize your knowledge graphs to better understand the relationships and structure.
  • Embedding: Generate embeddings for nodes to facilitate advanced graph-based analysis.
  • Path Finding: Implement algorithms to find paths between nodes.
  • Tokenization: Tokenize graph data for various processing tasks.
  • GraphRAG: Build and utilize Graph-based Retrieval Augmented Generation systems.

Building Knowledge Graphs 🌐

Using the provided classes, you can build comprehensive knowledge graphs. These graphs can help in organizing information, discovering relationships, and enhancing data analysis.

Benefits:

  • Organized Data: Represent your data in an easily understandable graph format.
  • Relationship Discovery: Identify and explore relationships between different data points.
  • Enhanced Analysis: Use graph-based analysis techniques to gain deeper insights into your data.

GraphRAG (Graph-based Retrieval Augmented Generation) 🚀

GraphRAG is a powerful technique that leverages knowledge graphs to enhance information retrieval and generation processes. By building and utilizing knowledge graphs, GraphRAG can provide more accurate and contextually relevant information.

Benefits:

  • Improved Retrieval: Enhance search and retrieval processes by leveraging the structure and relationships in knowledge graphs.
  • Contextual Generation: Generate contextually relevant information based on the interconnected data within the graph.
  • Advanced Insights: Use the power of knowledge graphs to derive insights that are not possible with traditional retrieval methods.

Getting Started

Installation

To install Euler Graph Database, you can use the following commands:

pip install euler-database

Quick Start

To get started with the Euler Graph Database, follow these steps:

from my_graph_lib.graph_api import KnowledgeGraphAPI
from my_graph_lib.faiss_db import FaissVectorDB

# Initialize API and Vector DB
api = KnowledgeGraphAPI()
vector_db = FaissVectorDB(dimension=64)

Create nodes

Create Graph nodes

api.create_node(id='1', label='Person', properties={'name': 'Alice', 'age': 30})
api.create_node(id='2', label='Person', properties={'name': 'Bob', 'age': 35})
api.create_node(id='3', label='Person', properties={'name': 'Charlie', 'age': 25})
api.create_node(id='4', label='Person', properties={'name': 'David', 'age': 40})
api.create_node(id='5', label='Person', properties={'name': 'Eve', 'age': 28})

Create edges

Create Graph Edges

api.create_edge(id='1-2', source='1', target='2', label='knows', properties={'since': '2020'})
api.create_edge(id='2-3', source='2', target='3', label='knows', properties={'since': '2018'})
api.create_edge(id='3-4', source='3', target='4', label='knows', properties={'since': '2015'})
api.create_edge(id='4-5', source='4', target='5', label='knows', properties={'since': '2021'})
api.create_edge(id='5-1', source='5', target='1', label='knows', properties={'since': '2019'})

Generate embeddings

Apply Embeddding on graphs

api.graph.generate_embeddings(method="simple", dimensions=64)
embeddings = {node_id: api.graph.get_embedding(node_id) for node_id in api.graph.nodes}
vector_db.add_vectors(list(embeddings.values()), list(map(int, embeddings.keys())))

Query embeddings

query_results = vector_db.query_vectors(api.graph.get_embedding('1'), k=2)
print("Query results:", query_results)