# Types of Nodes in the Understand-Anything Knowledge Graph: A Complete Taxonomy

> Explore the 21 node types in the Understand-Anything knowledge graph. Learn how file, function, domain, and claim nodes model source code and business concepts.

- Repository: [Yuxiang Lin/Understand-Anything](https://github.com/Lum1104/Understand-Anything)
- Tags: api-reference
- Published: 2026-06-08

---

**The Understand-Anything knowledge graph defines 21 distinct node types—ranging from `file` and `function` to `domain` and `claim`—that model everything from source code to business concepts.**

The Understand-Anything open-source project treats every element of a codebase, plus external knowledge, as a **node** inside a unified graph. Understanding the types of nodes in the knowledge graph is essential for filtering dashboards, traversing relationships, and interpreting the semantic model that powers the system. According to the Understand-Anything source code, the canonical taxonomy is declared in [`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts) and consumed by the dashboard store and graph builder.

## Code Nodes: File, Function, Class, Module, and Concept

The first five types cover traditional software artifacts. A **`file`** node represents a single source file, while a **`function`** node captures a function or method definition. The **`class`** node models class definitions, and a **`module`** node represents a module or package boundary. Finally, the **`concept`** node stores abstract ideas such as design patterns.

## Non-Code Nodes: Config, Document, Service, Table, and Endpoint

These five types extend the graph beyond source code. A **`config`** node holds configuration files or snippets, and a **`document`** node represents standalone documentation. The **`service`** node describes a deployable service descriptor, a **`table`** node maps to a database table definition, and an **`endpoint`** node marks an API endpoint.

## Infrastructure and Schema Nodes: Pipeline, Schema, and Resource

Infrastructure concerns are modeled by three specialized types. A **`pipeline`** node represents a CI/CD pipeline, a **`schema`** node defines a data schema, and a **`resource`** node generically describes infrastructure assets such as Docker images.

## Domain-Specific Nodes: Domain, Flow, and Step

Business logic and workflows receive first-class representation. A **`domain`** node denotes a business domain boundary, a **`flow`** node represents a workflow or process flow, and a **`step`** node captures an individual step inside a flow.

## Knowledge Nodes: Article, Entity, Topic, Claim, and Source

The final five types support external knowledge capture. An **`article`** node stores a written article, an **`entity`** node represents a real-world entity, and a **`topic`** node defines a subject area. A **`claim`** node records a factual claim, and a **`source`** node acts as a reference citation.

## Source of Truth for Node Types in [`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts)

The complete enumeration of all 21 types appears in the `NodeType` definition at lines 14–27 of [`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts). This file serves as the single source of truth for the entire taxonomy. The same module exports the `GraphNode` interface, which every node in the system must satisfy.

## Constructing a Knowledge Graph with Typed Nodes

Each node conforms to the `GraphNode` interface and carries a `type` field drawn from the `NodeType` union. The following example shows how to declare a `file` node and a `function` node, then add them to a `KnowledgeGraph`:

```ts
import type {
  GraphNode,
  NodeType,
  KnowledgeGraph,
} from "@understand-anything/core/types";

/* Example: a file node */
const fileNode: GraphNode = {
  id: "node-001",
  type: "file" as NodeType,
  name: "src/index.ts",
  summary: "Main entry point of the application",
  tags: ["entry", "typescript"],
  complexity: "simple",
};

/* Example: a function node */
const fnNode: GraphNode = {
  id: "node-002",
  type: "function",
  name: "handleRequest",
  filePath: "src/server.ts",
  lineRange: [42, 58],
  summary: "Processes incoming HTTP requests",
  tags: ["http", "handler"],
  complexity: "moderate",
};

/* Adding nodes to a knowledge graph */
const graph: KnowledgeGraph = {
  version: "1.0",
  kind: "codebase",
  project: {
    name: "example-app",
    languages: ["TypeScript"],
    frameworks: ["React"],
    description: "Demo project",
    analyzedAt: new Date().toISOString(),
    gitCommitHash: "abc123",
  },
  nodes: [fileNode, fnNode],
  edges: [],          // …populate edges as needed
  layers: [],         // …populate layers as needed
  tour: [],           // …populate tour steps as needed
};

```

## How the Graph Builder Maps Parser Kinds to Node Types

During analysis, [`packages/core/src/analyzer/graph-builder.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/analyzer/graph-builder.ts) translates language-specific parser output into graph nodes via the `mapKindToNodeType` function. This mapping ensures that a TypeScript class declaration becomes a `class` node and a Python function becomes a `function` node, maintaining consistency across languages.

## Filtering the Dashboard by Node Type

The dashboard store in [`packages/dashboard/src/store.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/dashboard/src/store.ts) exposes the full `ALL_NODE_TYPES` list and applies node-type filters to the UI. You can restrict the visible graph to only code-related types by passing a `Set` of allowed strings:

```ts
import { useDashboardStore } from "@understand-anything/dashboard/src/store";

// Show only code-related node types
useDashboardStore.getState().setFilters({
  nodeTypes: new Set(["file", "function", "class", "module", "concept"]),
});

```

## Validating the Taxonomy in Unit Tests

The test suite in [`packages/core/src/types.test.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.test.ts) guarantees that every declared `NodeType` value is assignable to `GraphNode["type"]`. This prevents drift between the type union and the runtime node builder.

## Summary

- The Understand-Anything knowledge graph recognizes **21 node types** divided into five categories: code, non-code, infrastructure/schema, domain-specific, and knowledge.
- The canonical list is declared in **[`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts)** inside the `NodeType` union at lines 14–27.
- Every node implements the **`GraphNode`** interface, which requires an `id`, a `type`, and descriptive metadata.
- The graph builder in **[`packages/core/src/analyzer/graph-builder.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/analyzer/graph-builder.ts)** uses **`mapKindToNodeType`** to normalize parser output into these types.
- The dashboard store in **[`packages/dashboard/src/store.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/dashboard/src/store.ts)** exposes **`ALL_NODE_TYPES`** and supports filtering the UI by any subset of types.

## Frequently Asked Questions

### How many node types does Understand-Anything support?

The Understand-Anything knowledge graph supports exactly **21 node types**. These range from code-centric types like `file` and `function` to conceptual types like `claim` and `topic`, all declared in [`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts).

### Where are the node types defined in the source code?

The canonical definition lives in **[`packages/core/src/types.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/types.ts)** at lines 14–27, where the `NodeType` union enumerates every valid type string. The `GraphNode` interface in the same file enforces this type on every node object.

### How does the analyzer assign node types during graph construction?

The graph builder located in **[`packages/core/src/analyzer/graph-builder.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/core/src/analyzer/graph-builder.ts)** uses a helper called **`mapKindToNodeType`** to map language-specific AST kinds to the canonical `NodeType` values. This ensures cross-language consistency when populating the `KnowledgeGraph`.

### Can I filter the dashboard to show only certain node types?

Yes. The dashboard store in **[`packages/dashboard/src/store.ts`](https://github.com/Lum1104/Understand-Anything/blob/main/packages/dashboard/src/store.ts)** maintains the full **`ALL_NODE_TYPES`** array and accepts a `nodeTypes` filter via `setFilters()`. Pass a `Set<string>` containing any combination of the 21 types to control which nodes render in the UI.