File size: 3,716 Bytes
40d7073 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /**
* Graph Wrapper - Hypergraph database for code relationships
*
* Wraps @ruvector/graph-node for dependency analysis, co-edit patterns,
* and code structure understanding.
*/
export declare function isGraphAvailable(): boolean;
export interface Node {
id: string;
labels: string[];
properties: Record<string, any>;
}
export interface Edge {
id?: string;
from: string;
to: string;
type: string;
properties?: Record<string, any>;
}
export interface Hyperedge {
id?: string;
nodes: string[];
type: string;
properties?: Record<string, any>;
}
export interface CypherResult {
columns: string[];
rows: any[][];
}
export interface PathResult {
nodes: Node[];
edges: Edge[];
length: number;
}
/**
* Graph Database for code relationships
*/
export declare class CodeGraph {
private inner;
private storagePath?;
constructor(options?: {
storagePath?: string;
inMemory?: boolean;
});
/**
* Create a node (file, function, class, etc.)
*/
createNode(id: string, labels: string[], properties?: Record<string, any>): Node;
/**
* Get a node by ID
*/
getNode(id: string): Node | null;
/**
* Update node properties
*/
updateNode(id: string, properties: Record<string, any>): boolean;
/**
* Delete a node
*/
deleteNode(id: string): boolean;
/**
* Find nodes by label
*/
findNodesByLabel(label: string): Node[];
/**
* Create an edge (import, call, reference, etc.)
*/
createEdge(from: string, to: string, type: string, properties?: Record<string, any>): Edge;
/**
* Get edges from a node
*/
getOutgoingEdges(nodeId: string, type?: string): Edge[];
/**
* Get edges to a node
*/
getIncomingEdges(nodeId: string, type?: string): Edge[];
/**
* Delete an edge
*/
deleteEdge(edgeId: string): boolean;
/**
* Create a hyperedge connecting multiple nodes
*/
createHyperedge(nodes: string[], type: string, properties?: Record<string, any>): Hyperedge;
/**
* Get hyperedges containing a node
*/
getHyperedges(nodeId: string, type?: string): Hyperedge[];
/**
* Execute a Cypher query
*/
cypher(query: string, params?: Record<string, any>): CypherResult;
/**
* Find shortest path between nodes
*/
shortestPath(from: string, to: string, maxDepth?: number): PathResult | null;
/**
* Get all paths between nodes (up to maxPaths)
*/
allPaths(from: string, to: string, maxDepth?: number, maxPaths?: number): PathResult[];
/**
* Get neighbors of a node
*/
neighbors(nodeId: string, depth?: number): Node[];
/**
* Calculate PageRank for nodes
*/
pageRank(iterations?: number, dampingFactor?: number): Map<string, number>;
/**
* Find connected components
*/
connectedComponents(): string[][];
/**
* Detect communities (Louvain algorithm)
*/
communities(): Map<string, number>;
/**
* Calculate betweenness centrality
*/
betweennessCentrality(): Map<string, number>;
/**
* Save graph to storage
*/
save(): void;
/**
* Load graph from storage
*/
load(): void;
/**
* Clear all data
*/
clear(): void;
/**
* Get graph statistics
*/
stats(): {
nodes: number;
edges: number;
hyperedges: number;
};
}
/**
* Create a code dependency graph from file analysis
*/
export declare function createCodeDependencyGraph(storagePath?: string): CodeGraph;
export default CodeGraph;
//# sourceMappingURL=graph-wrapper.d.ts.map |