# Class SkillDependencyGraph

Skill dependency graph implementation using adjacency list. Supports topological sorting, cycle detection, and version constraints.

#### Implements

- ISkillDependencyGraph

- Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:67

##### Index

### Constructors

constructor

### Methods

addSkill
addDependency
removeDependency
getDependencies
getDependents
getExecutionOrder
hasCircularDependency
validateGraph
getSkillCount
hasSkill

## Constructors

### constructor

- new SkillDependencyGraph(): SkillDependencyGraph

  #### Returns SkillDependencyGraph

## Methods

### addSkill

- addSkill(skillId: string, version?: number): void

  Adds a skill node to the graph.

  #### Parameters

  - skillId: string
  - version: number = 1

  #### Returns void

  Implementation of ISkillDependencyGraph.addSkill

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:75

### addDependency

- addDependency(dependency: SkillDependency): Result<void, DependencyError>

  Adds a dependency edge between two skills.

  #### Parameters

  - dependency: SkillDependency

  #### Returns Result<void, DependencyError>

  Implementation of ISkillDependencyGraph.addDependency

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:88

### removeDependency

- removeDependency(skillId: string, dependsOn: string): boolean

  Removes a dependency edge between two skills.

  #### Parameters

  - skillId: string
  - dependsOn: string

  #### Returns boolean

  Implementation of ISkillDependencyGraph.removeDependency

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:134

### getDependencies

- getDependencies(skillId: string): readonly SkillDependency[]

  Gets all dependencies for a skill.

  #### Parameters

  - skillId: string

  #### Returns readonly SkillDependency[]

  Implementation of ISkillDependencyGraph.getDependencies

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:151

### getDependents

- getDependents(skillId: string): readonly string[]

  Gets all skills that depend on a given skill.

  #### Parameters

  - skillId: string

  #### Returns readonly string[]

  Implementation of ISkillDependencyGraph.getDependents

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:157

### getExecutionOrder

- getExecutionOrder(
  skillIds: readonly string[],
  ): Result<readonly string[], DependencyError>

  Gets execution order for given skills using Kahn's algorithm.

  #### Parameters

  - skillIds: readonly string[]

  #### Returns Result<readonly string[], DependencyError>

  Implementation of ISkillDependencyGraph.getExecutionOrder

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:163

### hasCircularDependency

- hasCircularDependency(skillId: string): boolean

  Checks if a skill has a circular dependency.

  #### Parameters

  - skillId: string

  #### Returns boolean

  Implementation of ISkillDependencyGraph.hasCircularDependency

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:178

### validateGraph

- validateGraph(): Result<void, DependencyError>

  Validates the entire graph for consistency.

  #### Returns Result<void, DependencyError>

  Implementation of ISkillDependencyGraph.validateGraph

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:186

### getSkillCount

- getSkillCount(): number

  Gets the number of skills in the graph.

  #### Returns number

  Implementation of ISkillDependencyGraph.getSkillCount

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:229

### hasSkill

- hasSkill(skillId: string): boolean

  Checks if a skill exists in the graph.

  #### Parameters

  - skillId: string

  #### Returns boolean

  Implementation of ISkillDependencyGraph.hasSkill

  - Defined in packages/nexus-agents/src/agents/skills/skill-dependency-graph.ts:234