Understand Anything Knowledge Graph Node Types: Complete Guide to All 21 Types
The Understand Anything engine supports 21 distinct node types organized into four logical families—Code, Non-code, Domain, and Knowledge—with the complete taxonomy defined in the NodeType union at understand-anything-plugin/packages/core/src/types.ts.
The Egonex-AI/Understand-Anything repository models complex codebases and conceptual domains as structured knowledge graphs. Every graph entity is instantiated as a GraphNode object with a strictly typed type field that must match one of the 21 values defined in the core type declarations.
The Four Families of Node Types
The NodeType union in packages/core/src/types.ts enumerates 21 distinct node types divided into four functional categories. These types drive graph construction, schema validation, and dashboard visualization throughout the engine.
Code Structure Nodes (5 Types)
The graph-builder module located at packages/core/src/analyzer/graph-builder.ts extracts structural information from source files to create nodes representing programmatic constructs:
file– Represents individual source files in the codebase.function– Represents functions, methods, and callable units.class– Represents object-oriented class definitions.module– Represents namespaces, packages, or ES modules.concept– Represents abstract programming concepts or patterns identified in code.
Infrastructure and Configuration Nodes (8 Types)
These types model runtime architecture, deployment configuration, and data stores:
config– Configuration files and environment settings.document– External documentation and markdown files.service– Microservices, daemons, and long-running processes.table– Database tables and data storage structures.endpoint– API endpoints and network interfaces.pipeline– CI/CD pipelines and data processing workflows.schema– Data schemas, JSON schemas, and type definitions.resource– Generic infrastructure resources and assets.
Domain Logic Nodes (3 Types)
These nodes capture business logic, workflows, and domain-specific processes:
domain– Bounded contexts and business domains.flow– User flows, data flows, or process flows.step– Individual steps within a flow or workflow.
Knowledge and Documentation Nodes (5 Types)
These types represent conceptual understanding, research, and external knowledge:
article– Knowledge base articles and wiki entries.entity– Real-world entities and business objects.topic– Subject matters and thematic categories.claim– Assertions, facts, or documented statements.source– References, citations, and external source materials.
How Node Types Are Defined and Enforced
The type system is enforced through two critical validation layers. First, the NodeType union in packages/core/src/types.ts provides compile-time type safety, ensuring only the 21 supported string literals can be assigned to a node's type property. Second, the schema module at packages/core/src/schema.ts implements runtime validation that rejects any node with an unrecognized type before it enters the knowledge graph.
Because the union is exhaustive, developers extending the graph must select from these predefined types. The GraphNode interface requires fields including id, type, name, summary, tags, and complexity, with the type field strictly constrained to the NodeType union.
Working with Node Types in Practice
When constructing a knowledge graph manually, you instantiate nodes by specifying one of the supported types in the type field:
import { KnowledgeGraph, GraphNode, GraphEdge } from '@understand-anything/core';
// Define nodes using supported types
const nodes: GraphNode[] = [
{ id: 'file:src/index.ts', type: 'file', name: 'src/index.ts', summary: 'Entry point', tags: [], complexity: 'simple' },
{ id: 'function:src/index.ts:main', type: 'function', name: 'main', summary: 'Bootstraps the app', tags: [], complexity: 'moderate' },
{ id: 'article:docs/overview.md', type: 'article', name: 'Overview', summary: 'Project overview', tags: [], complexity: 'simple' },
];
// Create relationships between nodes
const edges: GraphEdge[] = [
{ source: 'file:src/index.ts', target: 'function:src/index.ts:main', type: 'contains', direction: 'forward', weight: 1 },
{ source: 'function:src/index.ts:main', target: 'article:docs/overview.md', type: 'documents', direction: 'forward', weight: 0.5 },
];
// Assemble the complete graph
const graph: KnowledgeGraph = {
version: '1.0',
project: { name: 'MyApp', languages: ['ts'], frameworks: [], description: '', analyzedAt: new Date().toISOString(), gitCommitHash: '' },
nodes,
edges,
layers: [],
tour: [],
};
To query the graph for specific node types, use the search utility to filter by the type property:
import { search } from '@understand-anything/core';
const functionNodes = search(graph, node => node.type === 'function');
console.log('Functions:', functionNodes.map(n => n.name));
Node Types in the Dashboard
The front-end store at packages/dashboard/src/store.ts categorizes nodes by their type field to drive the visualization layer. The dashboard applies distinct colors and grouping rules based on the four families (Code, Non-code, Domain, Knowledge), enabling the "graph-first" layout that distinguishes between source code files, infrastructure components, and conceptual knowledge.
Summary
- 21 supported types: The
NodeTypeunion inpackages/core/src/types.tsdefines exactly 21 valid node type strings. - Four logical families: Code (5), Non-code (8), Domain (3), and Knowledge (5) group related concepts.
- Strict validation: The schema module at
packages/core/src/schema.tsenforces type constraints at runtime. - Graph construction: The analyzer in
packages/core/src/analyzer/graph-builder.tsautomatically generates nodes of these types from source code. - UI integration: The dashboard uses node types to determine rendering colors, filters, and layout groupings.
Frequently Asked Questions
Can I create custom node types beyond the 21 defined values?
No. The NodeType union in packages/core/src/types.ts is exhaustive, and the schema validation in packages/core/src/schema.ts will reject nodes with unrecognized type strings. To extend the graph, map your custom entities to the existing types (for example, map a database view to the table type or a microservice to the service type) and use the tags or metadata fields for finer-grained categorization.
What is the difference between concept and entity node types?
The concept type represents abstract programming patterns or architectural ideas identified within code (such as "singleton pattern" or "repository pattern"), while the entity type represents concrete real-world objects or business objects documented in knowledge articles (such as "User" or "Order"). Concepts typically originate from code analysis in graph-builder.ts, whereas entities populate the knowledge base from documentation.
How does the Understand Anything dashboard visualize different node types?
The dashboard store at packages/dashboard/src/store.ts indexes nodes by their type field and applies family-based color schemes. Code structure nodes (file, function, class) receive developer-centric styling, while Knowledge nodes (article, claim, source) receive documentation styling. This enables visual filtering where users can toggle entire families on or off to focus on specific aspects of the system.
What happens if I try to add a node with an invalid type?
The graph will fail schema validation. When calling validation functions exported from packages/core/src/schema.ts, the system checks that every node's type property exists in the NodeType union. If you attempt to create a node with a type like customType that is not one of the 21 supported values, the validation throws a runtime error before the node is persisted to the KnowledgeGraph object.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →