def list_graphs() -> List[Graph]
def list_graphs() -> List[Graph]
async def list_graphs() -> List[Graph]
Parameters
None
Returns
List[Graph]
: List of graph objects
Examples
from morphik import Morphik
db = Morphik()
# List all accessible graphs
graphs = db.list_graphs()
for graph in graphs:
status = graph.status or "completed"
print(
f"Graph: {graph.name} (status={status}), "
f"Entities: {len(graph.entities)}, Relationships: {len(graph.relationships)}",
)
# Find the most recent graph
latest_graph = max(graphs, key=lambda g: g.updated_at)
print(f"Most recently updated: {latest_graph.name} (updated {latest_graph.updated_at})")
from morphik import Morphik
db = Morphik()
# List all accessible graphs
graphs = db.list_graphs()
for graph in graphs:
status = graph.status or "completed"
print(
f"Graph: {graph.name} (status={status}), "
f"Entities: {len(graph.entities)}, Relationships: {len(graph.relationships)}",
)
# Find the most recent graph
latest_graph = max(graphs, key=lambda g: g.updated_at)
print(f"Most recently updated: {latest_graph.name} (updated {latest_graph.updated_at})")
from morphik import AsyncMorphik
async with AsyncMorphik() as db:
# List all accessible graphs
graphs = await db.list_graphs()
for graph in graphs:
status = graph.status or "completed"
print(
f"Graph: {graph.name} (status={status}), "
f"Entities: {len(graph.entities)}, Relationships: {len(graph.relationships)}",
)
# Find the most recent graph
latest_graph = max(graphs, key=lambda g: g.updated_at)
print(f"Most recently updated: {latest_graph.name} (updated {latest_graph.updated_at})")
Graph Properties
Each Graph
object in the returned list has the following properties:
id
(str): Unique graph identifier
name
(str): Graph name
entities
(List[Entity]): List of entities in the graph
relationships
(List[Relationship]): List of relationships in the graph
metadata
(Dict[str, Any]): Graph metadata
document_ids
(List[str]): Source document IDs
filters
(Dict[str, Any], optional): Document filters used to create the graph
created_at
(datetime): Creation timestamp
updated_at
(datetime): Last update timestamp
owner
(Dict[str, str]): Graph owner information
access_control
(Dict[str, List[str]]): Access control information