Package storage.graph
class BaseGraph<V, E>
func clear
func clear(): Unit
func getAllNodes
func getAllNodes(): Array<NodeContainer<V, E>>
func getEdges
func getEdges(srcId: String, tgtId: String): Array<Edge<E>>
- 描述: 获取边
- 参数:
srcId: String, 源顶点ID
tgtId: String, 目标顶点ID
func getIncomingEdgesOf
func getIncomingEdgesOf(id: String): Array<Edge<E>>
func getOutgoingEdgesOf
func getOutgoingEdgesOf(id: String): Array<Edge<E>>
func getVertex
func getVertex(id: String): ?Vertex<V>
func getVertexTypes
func getVertexTypes(): Set<String>
func getVertices
func getVertices(): Array<Vertex<V>>
func hasEdge
func hasEdge(srcId: String, tgtId: String): Bool
- 描述: 判断是否存在边
- 参数:
srcId: String, 源顶点ID
tgtId: String, 目标顶点ID
func hasVertex
func hasVertex(id: String): Bool
func removeEdge
func removeEdge(e: Edge<E>): Unit
func removeVertex
func removeVertex(id: String): Unit
func upsertEdge
func upsertEdge(e: Edge<E>): Unit
func upsertVertex
func upsertVertex(v: Vertex<V>): Unit
class BaseLocalGraphStorage<V, E>
func close
public func close(): Unit
prop collection
public prop collection: String
func commit
public func commit(): Unit
func getAllVertices
public func getAllVertices(): Array<Vertex<V>>
func getEdge
public func getEdge(srcId: String, tgtId: String, eType: String): Option<Edge<E>>
- 描述: 获取指定源顶点、目标顶点和边类型的边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
eType: String, 边的类型
func getEdges
public func getEdges(srcId: String, tgtId: String): Array<Edge<E>>
- 描述: 获取从源顶点到目标顶点的所有边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
func getIncomingEdgesOf
public func getIncomingEdgesOf(id: String): Array<Edge<E>>
func getOutgoingEdgesOf
public func getOutgoingEdgesOf(id: String): Array<Edge<E>>
func getVertex
public func getVertex(id: String): Option<Vertex<V>>
func getVertexTypes
public func getVertexTypes(): Set<String>
func hasEdge
public func hasEdge(srcId: String, tgtId: String): Bool
- 描述: 检查图中是否存在从源顶点到目标顶点的边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
func hasVertex
public func hasVertex(id: String): Bool
func init
public init(workspace!: String = ".storage", collection!: String = "default")
- 描述: 初始化本地图存储
- 参数:
workspace: String, 存储的工作目录
collection: String, 存储的集合名称
func removeEdge
public func removeEdge(e: Edge<E>): Unit
func removeVertex
public func removeVertex(id: String): Unit
func reset
public func reset(): Unit
func upsertEdge
public func upsertEdge(edge: Edge<E>): Unit
func upsertVertex
public func upsertVertex(vertex: Vertex<V>): Unit
- 描述: 插入或更新顶点
- 参数:
vertex: Vertex<V>, 要插入或更新的顶点
prop workspace
public prop workspace: String
class Edge
func operator !=
operator func !=(other: Edge<E>): Bool
func operator ==
operator func ==(other: Edge<E>): Bool
prop data
prop data: Option<E>
func deserialize
static func deserialize(dm: DataModel)
prop eType
prop eType: String
func fromJson
static func fromJson(str: String): Edge<E>
func hashCode
func hashCode(): Int64
func init
init(srcId: String, tgtId: String, eType!: String = "DEFAULT", weight!: Float64 = 1.0, data!: Option<E> = None)
- 描述: 构造函数,初始化边
- 参数:
srcId: String, 源顶点ID
tgtId: String, 目标顶点ID
eType: String, 边类型,默认为"DEFAULT"
weight: Float64, 边权重,默认为1.0
data: Option<E>, 边数据,默认为None
func serialize
func serialize(): DataModel
prop srcId
prop srcId: String
prop tgtId
prop tgtId: String
func toJsonString
func toJsonString(): String
prop uniqueId
prop uniqueId: String
prop weight
mut prop weight: Float64
interface GraphStorage<V, E>
func getAllVertices
func getAllVertices(): Array<Vertex<V>>
func getEdge
func getEdge(srcId: String, tgtId: String, eType: String): Option<Edge<E>>
- 描述: 获取指定源顶点、目标顶点和边类型的边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
eType: String, 边的类型
func getEdges
func getEdges(srcId: String, tgtId: String): Array<Edge<E>>
- 描述: 获取从源顶点到目标顶点的所有边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
func getIncomingEdgesOf
func getIncomingEdgesOf(id: String): Array<Edge<E>>
func getOutgoingEdgesOf
func getOutgoingEdgesOf(id: String): Array<Edge<E>>
func getVertex
func getVertex(id: String): Option<Vertex<V>>
func getVertexTypes
func getVertexTypes(): Set<String>
func hasEdge
func hasEdge(srcId: String, tgtId: String): Bool
- 描述: 检查图中是否存在从源顶点到目标顶点的边
- 参数:
srcId: String, 源顶点的唯一标识符
tgtId: String, 目标顶点的唯一标识符
func hasVertex
func hasVertex(id: String): Bool
func removeEdge
func removeEdge(e: Edge<E>): Unit
func removeVertex
func removeVertex(id: String): Unit
func upsertEdge
func upsertEdge(edge: Edge<E>): Unit
func upsertVertex
func upsertVertex(vertex: Vertex<V>): Unit
- 描述: 插入或更新顶点
- 参数:
vertex: Vertex<V>, 要插入或更新的顶点
class IllegalEdgeException
func init
init(message: String)
interface LocalGraphStorage<V, E>
class NodeContainer<V, E>
func addIncomingEdge
func addIncomingEdge(e: Edge<E>): Unit
func addOutgoingEdge
func addOutgoingEdge(e: Edge<E>): Unit
prop incoming
prop incoming: Set<Edge<E>>
prop outgoing
prop outgoing: Set<Edge<E>>
func removeIncomingEdge
func removeIncomingEdge(e: Edge<E>): Unit
func removeOutgoingEdge
func removeOutgoingEdge(e: Edge<E>): Unit
prop vertex
mut prop vertex: Vertex<V>
class Vertex
func operator !=
operator func !=(other: Vertex<V>): Bool
func operator ==
operator func ==(other: Vertex<V>): Bool
prop data
prop data: Option<V>
func deserialize
static func deserialize(dm: DataModel): Vertex<V>
func fromJsonString
static func fromJsonString(str: String): Vertex<V>
func hashCode
func hashCode(): Int64
prop id
prop id: String
func init
init(id: String, vType!: String = "DEFAULT", data!: Option<V> = None)
- 描述: 构造函数,初始化顶点
- 参数:
id: String, 顶点ID
vType: String, 顶点类型,默认为"DEFAULT"
data: Option<V>, 顶点数据,默认为None
func serialize
func serialize(): DataModel
func toJsonString
func toJsonString(): String
prop vType
prop vType: String