Skip to content

Commit

Permalink
Fix: Fixes import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
hajdul88 committed Nov 14, 2024
1 parent d3fddda commit b516862
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cognee/modules/graph/cognee_graph/CogneeAbstractGraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from typing import List, Dict, Union
from CogneeGraphElements import Node, Edge
from cognee.modules.graph.cognee_graph.CogneeGraphElements import Node, Edge
from cognee.infrastructure.databases.graph.graph_db_interface import GraphDBInterface

class CogneeAbstractGraph(ABC):
Expand Down
31 changes: 29 additions & 2 deletions cognee/modules/graph/cognee_graph/CogneeGraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Dict, Union
from CogneeGraphElements import Node, Edge
from CogneeAbstractGraph import CogneeAbstractGraph
from cognee.modules.graph.cognee_graph.CogneeGraphElements import Node, Edge
from cognee.modules.graph.cognee_graph.CogneeAbstractGraph import CogneeAbstractGraph
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.infrastructure.databases.graph.neo4j_driver.adapter import Neo4jAdapter
from cognee.infrastructure.databases.graph.networkx.adapter import NetworkXAdapter
Expand Down Expand Up @@ -90,3 +90,30 @@ async def project_graph_from_db(self,
print(f"Error projecting graph: {e}")
except Exception as ex:
print(f"Unexpected error: {ex}")


"""
The following code only used for test purposes and will be deleted later
"""
import asyncio

async def main():
# Choose the adapter (Neo4j or NetworkX)
adapter = await get_graph_engine()

# Create an instance of CogneeGraph
graph = CogneeGraph()

# Project the graph from the database
await graph.project_graph_from_db(adapter,
["description", "name", "type", "text"],
["relationship_name"],
directed=True,
node_dimension=1,
edge_dimension=10000)

# Access nodes and edges
print(f"Graph has {len(graph.nodes)} nodes and {len(graph.edges)} edges.")

# Run the main function
asyncio.run(main())

0 comments on commit b516862

Please sign in to comment.