Javis OS
Javis OS는 기업가를 돕는 에이전시 AI로, 업무를 지원하고 함께 성장합니다
QuokkaQuery는 소프트웨어 제작 전 단계인 설계와 형태 정의를 위한 전용 도구를 만드는 소규모 스튜디오이다
QuokkaQuery is a small software studio making software for making software — focused tools for the designing and shaping that happens before anything ships.
비즈니스TypeScriptGitHub @Nodlume온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기Generic reusable graph library with structure representation and traversal methods
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Built and maintained by QuokkaQuery. Source on GitHub.
Generic TypeScript graph library with adjacency-list representation. Supports directed and undirected graphs, weighted edges, traversals, and common graph algorithms.
npm install @quokkaquery/graph
import { Graph } from "@quokkaquery/graph";
const g = new Graph<string>({ directed: true });
g.addNode("a", "Alice")
.addNode("b", "Bob")
.addNode("c", "Carol");
g.addEdge("a", "b", 1);
g.addEdge("b", "c", 2);
g.addEdge("a", "c", 10);
// Shortest path
const result = g.dijkstra("a", "c");
// { distance: 3, path: ["a", "b", "c"] }
new Graph<T, E>(opts?: { directed?: boolean })
T — node data type (default unknown)E — edge data type (default unknown)directed — defaults to true| Method | Returns | Description |
|---|---|---|
addNode(id, data) | this | Add a node (chainable) |
getNode(id) | GraphNode<T> | undefined | Get node by id |
hasNode(id) | boolean | Check if node exists |
removeNode(id) | boolean | Remove node and all its edges |
nodeCount | number | Number of nodes |
nodeIds() | NodeId[] | All node ids |
nodeEntries() | GraphNode<T>[] | All nodes |
| Method | Returns | Description |
|---|---|---|
addEdge(from, to, weight?, data?) | this | Add an edge (chainable, default weight 1) |
getEdge(from, to) | Edge<E> | undefined | Get edge between two nodes |
hasEdge(from, to) | boolean | Check if edge exists |
removeEdge(from, to) | boolean | Remove an edge |
edgeCount | number | Number of edges |
edges() | Edge<E>[] | All edges (deduplicated for undirected) |
| Method | Returns | Description |
|---|---|---|
neighbors(id) | NodeId[] | Outgoing neighbor ids |
outEdges(id) | Edge<E>[] | Outgoing edges |
inEdges(id) | Edge<E>[] | Incoming edges |
outDegree(id) | number | Number of outgoing edges |
inDegree(id) | number | Number of incoming edges |
degree(id) | number | Total degree |
predecessors(id) | NodeId[] | Nodes with edges pointing to this node |
successors(id) | NodeId[] | Nodes this node points to |
connectedNodes(id) | NodeId[] | Union of predecessors and successors |
| Method | Returns | Description |
|---|---|---|
isSource(id) | boolean | In-degree 0 (directed only) |
isSink(id) | boolean | Out-degree 0 (directed only) |
isIsolated(id) | boolean | Degree 0 |
sources() | NodeId[] | All source nodes |
sinks() | NodeId[] | All sink nodes |
isolatedNodes() | NodeId[] | All isolated nodes |
| Method | Returns | Description |
|---|---|---|
reachableFrom(id) | Set<NodeId> | All nodes reachable via outgoing edges |
reachableTo(id) | Set<NodeId> | All nodes that can reach this node |
| Method | Description |
|---|---|
bfs(start, visitor) | Breadth-first traversal. Return false from visitor to stop early. |
dfs(start, visitor) | Depth-first traversal. Return false from visitor to stop early. |
findBfs(start, predicate) | Find first node matching predicate via BFS |
findDfs(start, predicate) | Find first node matching predicate via DFS |
| Method | Description |
|---|---|
topologicalSort() | Kahn's algorithm. Throws if graph has a cycle. Directed only. |
hasCycle() | Cycle detection (DFS for directed, Union-Find for undirected) |
dijkstra(start, end) | Shortest path. Returns { distance, path } or undefined. |
connectedComponents() | Connected (undirected) or weakly-connected (directed) components |
| Method | Description |
|---|---|
mapNodes(fn) | Transform node data, producing a new graph |
subgraph(ids) | Extract a subgraph containing only the given node ids |
type NodeId = string | number;
interface GraphNode<T> { id: NodeId; data: T }
interface Edge<E> { from: NodeId; to: NodeId; weight: number; data: E }
type Visitor<T> = (node: GraphNode<T>, depth: number) => void | false;
type NodePredicate<T> = (node: GraphNode<T>) => boolean;
npm test # run tests
npm run test:watch # watch mode
npm run build # compile TypeScript
undefined data. If you need typed data, call addNode first.edges() deduplicates but outEdges()/inEdges() do not."Graph contains a cycle" — catch it or check hasCycle() first.const deps = new Graph<string>();
deps.addEdge("build", "lint");
deps.addEdge("test", "build");
const order = deps.topologicalSort(); // ["test", "build", "lint"]
const g = new Graph<string>();
g.addEdge("a", "b", 4).addEdge("b", "c", 2).addEdge("a", "c", 7);
const result = g.dijkstra("a", "c"); // { distance: 6, path: ["a", "b", "c"] }
const important = new Set(g.nodeIds().filter(id => g.degree(id) > 3));
const sub = g.subgraph(important);
MIT © QuokkaQuery
Part of the open-source tooling behind QuokkaQuery.