maid_runner.KnowledgeGraph

class maid_runner.KnowledgeGraph

Container class for managing nodes and edges in a knowledge graph.

__init__()

Initialize an empty knowledge graph.

Return type:

None

Methods

__init__()

Initialize an empty knowledge graph.

add_edge(edge)

Add an edge to the graph.

add_node(node)

Add a node to the graph.

get_edges(node_id[, edge_type])

Get edges for a node, optionally filtered by edge type.

get_node(node_id)

Retrieve a node by its ID.

Attributes

edge_count

Return the number of edges in the graph.

edges

Return all edges in the graph.

node_count

Return the number of nodes in the graph.

nodes

Return all nodes in the graph.