Graph

org.llm4s.knowledgegraph.Graph
See theGraph companion object
case class Graph(nodes: Map[String, Node], edges: List[Edge])

Represents a Knowledge Graph containing nodes and edges.

Value parameters

edges

List of Edges in the graph

nodes

Map of Node ID to Node object

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def addEdge(edge: Edge): Graph

Adds an edge to the graph.

Adds an edge to the graph.

Attributes

def addNode(node: Node): Graph

Adds a node to the graph.

Adds a node to the graph.

Attributes

def findNodesByLabel(label: String): List[Node]

Finds nodes by label.

Finds nodes by label.

Attributes

def findNodesByProperty(key: String, value: String): List[Node]

Finds nodes by property value. Compares against the JSON string representation of the value.

Finds nodes by property value. Compares against the JSON string representation of the value.

Attributes

def getConnectedEdges(nodeId: String): List[Edge]

Gets all edges connected to a node (both incoming and outgoing).

Gets all edges connected to a node (both incoming and outgoing).

Attributes

def getIncomingEdges(nodeId: String): List[Edge]

Gets incoming edges to a node.

Gets incoming edges to a node.

Attributes

def getNeighbors(nodeId: String): Set[Node]

Gets neighbor nodes (both incoming and outgoing).

Gets neighbor nodes (both incoming and outgoing).

Attributes

def getOutgoingEdges(nodeId: String): List[Edge]

Gets outgoing edges from a node.

Gets outgoing edges from a node.

Attributes

def hasEdge(source: String, target: String, relationship: Option[String]): Boolean

Checks if an edge exists between two nodes.

Checks if an edge exists between two nodes.

Attributes

def hasNode(nodeId: String): Boolean

Checks if a node exists in the graph.

Checks if a node exists in the graph.

Attributes

def merge(other: Graph): Graph

Merges another graph into this one.

Merges another graph into this one.

Attributes

def validate(): Result[Unit]

Validates graph integrity - ensures all edge endpoints exist in node set.

Validates graph integrity - ensures all edge endpoints exist in node set.

Attributes

Returns

Right(()) if valid, Left(error) if invalid

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product