Understand Anything Edge Types: A Complete Guide to Knowledge Graph Relationships

Understand Anything models knowledge graph relationships using 35 distinct EdgeType values organized into eight semantic categories, defined in packages/core/src/types.ts and categorized via EDGE_CATEGORY_MAP in packages/dashboard/src/store.ts.

The open-source Understand Anything repository by Egonex-AI provides a sophisticated graph-based knowledge engine that relies on typed relationships to connect entities. These edge types used to model relationships in Understand Anything are implemented as a strict TypeScript union type, enabling precise semantic modeling across structural, behavioral, and domain-specific connections.

The EdgeType Union: 35 Typed Relationships

At the core of the system lies the EdgeType union type declared in packages/core/src/types.ts. This type-safe enumeration defines exactly 35 relationship variants that span functional dependencies, data flows, and semantic associations.

The complete type definition groups edges into logical categories:

export type EdgeType =
  | "imports" | "exports" | "contains" | "inherits" | "implements"          // Structural
  | "calls" | "subscribes" | "publishes" | "middleware"                // Behavioral
  | "reads_from" | "writes_to" | "transforms" | "validates"           // Data flow
  | "depends_on" | "tested_by" | "configures"                         // Dependencies
  | "related" | "similar_to"                                         // Semantic
  | "deploys" | "serves" | "provisions" | "triggers"
  | "migrates" | "documents" | "routes" | "defines_schema"        // Infrastructure
  | "contains_flow" | "flow_step" | "cross_domain"                // Domain
  | "cites" | "contradicts" | "builds_on" | "exemplifies"
  | "categorized_under" | "authored_by";                              // Knowledge

Eight Semantic Categories of Edge Types

The 35 edge types are organized into eight semantic categories that reflect different aspects of software and knowledge architecture.

Structural Relationships

Structural edges define containment, inheritance, and module boundaries:

  • imports - Module import relationships
  • exports - Public API surface exposure
  • contains - Hierarchical container membership
  • inherits - Class or prototype inheritance chains
  • implements - Interface or contract implementation

Behavioral Relationships

Behavioral edges capture execution flow and interaction patterns:

  • calls - Function or method invocation
  • subscribes - Event or stream subscription
  • publishes - Event emission or message publishing
  • middleware - Interceptor or middleware chain participation

Data-Flow Relationships

Data-flow edges track how information moves through the system:

  • reads_from - Data consumption sources
  • writes_to - Data persistence targets
  • transforms - Data mapping or transformation operations
  • validates - Schema or constraint validation

Dependencies

Dependency edges model testing and configuration relationships:

  • depends_on - Runtime or build dependencies
  • tested_by - Test coverage links
  • configures - Configuration provision or override

Semantic Relationships

Semantic edges provide loose coupling and similarity metrics:

  • related - General association without specific semantics
  • similar_to - Similarity or approximation links

Infrastructure and Schema

Infrastructure edges handle deployment and routing concerns:

  • deploys - Deployment targets or artifacts
  • serves - Service provision relationships
  • provisions - Infrastructure resource allocation
  • triggers - Automated execution triggers
  • migrates - Database or schema migrations
  • documents - Documentation generation targets
  • routes - Network or application routing rules
  • defines_schema - Schema definition relationships

Domain-Specific Relationships

Domain edges model cross-cutting business logic flows:

  • contains_flow - Business process containment
  • flow_step - Sequential process step relationships
  • cross_domain - Inter-domain communication or coupling

Knowledge Graph Relationships

Knowledge edges enable academic and citation networks:

  • cites - Bibliographic or reference citations
  • contradicts - Opposition or refutation relationships
  • builds_on - Foundational dependency or extension
  • exemplifies - Instance or example relationships
  • categorized_under - Taxonomic classification
  • authored_by - Attribution and authorship

Categorization and Filtering Implementation

While the core library defines raw edge types, the dashboard layer in packages/dashboard/src/store.ts maps these into higher-level edge categories via the EDGE_CATEGORY_MAP constant. This mapping enables users to filter complex graphs by semantic groups rather than individual edge types.

The filtering logic in packages/dashboard/src/utils/filters.ts leverages this map to include or exclude relationships based on user-selected categories, while packages/dashboard/src/utils/edgeAggregation.ts respects edge types when collapsing hierarchical nodes.

Working with Edge Types in Practice

Creating Typed Graph Edges

To instantiate a relationship in the graph model, use the GraphEdge interface with a valid EdgeType:

import type { GraphEdge } from "@understand-anything/core/types";

const edge: GraphEdge = {
  source: "nodeA",
  target: "nodeB",
  type: "calls",
  direction: "forward",
  weight: 0.8,
  description: "nodeA invokes nodeB",
};

Filtering by Category

The dashboard store provides category mapping for granular filtering:

import { useDashboardStore } from "./store";
import type { GraphEdge, EdgeCategory } from "@understand-anything/core/types";

const edges: GraphEdge[] = /* obtain from graph */;

const structuralCategories: EdgeCategory[] = ["structural"];
const structuralEdges = edges.filter(
  (e) => structuralCategories.includes(
    Object.entries(useDashboardStore.getState().EDGE_CATEGORY_MAP).find(
      ([, types]) => types.includes(e.type)
    )?.[0] as EdgeCategory
  )
);

Displaying Edge Labels

For UI representation, edge types can be formatted for readability:

import type { GraphEdge } from "@understand-anything/core/types";

function EdgeLabel({ edge }: { edge: GraphEdge }) {
  return (
    <span className="edge-label">
      {edge.type.replace(/_/g, " ")}
    </span>
  );
}

Summary

  • Understand Anything defines 35 distinct edge types as a TypeScript union in packages/core/src/types.ts.
  • These types organize into eight semantic categories: Structural, Behavioral, Data-flow, Dependencies, Semantic, Infrastructure/Schema, Domain, and Knowledge.
  • The EDGE_CATEGORY_MAP in packages/dashboard/src/store.ts enables category-level filtering and UI controls.
  • Edge creation requires specifying source, target, type (from the EdgeType union), and optional weight and description fields.
  • Aggregation and filtering utilities in the dashboard respect these type definitions when processing graph visualizations.

Frequently Asked Questions

How many edge types does Understand Anything support?

Understand Anything supports 35 distinct edge types modeled as a TypeScript union type. This comprehensive set covers everything from code-level relationships like imports and calls to semantic relationships like cites and contradicts.

Where are edge types defined in the Understand Anything codebase?

Edge types are defined in packages/core/src/types.ts as the EdgeType union type. The dashboard categorization logic resides in packages/dashboard/src/store.ts, which maps individual types to broader semantic categories for UI filtering.

How does the dashboard categorize edge types for filtering?

The dashboard uses the EDGE_CATEGORY_MAP constant in packages/dashboard/src/store.ts to group the 35 raw edge types into eight semantic categories. This mapping allows users to filter graph views by category (e.g., showing only "Structural" or "Data-flow" relationships) rather than toggling individual edge types.

Can custom edge types be added to Understand Anything?

While the current implementation uses a fixed union type in packages/core/src/types.ts, the architecture supports extension through TypeScript's type system. Adding new edge types requires updating the EdgeType union in the core package and potentially registering new category mappings in the dashboard store to ensure proper filtering and visualization.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →