# Interface InteractionGraph

Interface for the interaction graph.

interface InteractionGraph {
addNode(agentId: string): void;
addEdge(edge: InteractionEdge): void;
getNodes(): string[];
getEdges(): InteractionEdge[];
getOutgoingEdges(agentId: string): InteractionEdge[];
getIncomingEdges(agentId: string): InteractionEdge[];
getDegreeCentrality(): Map<string, number>;
getStronglyConnectedComponents(): string[][];
getEdgeCount(from: string, to: string): number;
clear(): void;
}

#### Implemented by

- DirectedInteractionGraph

- Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:253

##### Index

### Methods

addNode
addEdge
getNodes
getEdges
getOutgoingEdges
getIncomingEdges
getDegreeCentrality
getStronglyConnectedComponents
getEdgeCount
clear

## Methods

### addNode

- addNode(agentId: string): void

  Add a node (agent) to the graph.

  #### Parameters

  - agentId: string

  #### Returns void

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:257

### addEdge

- addEdge(edge: InteractionEdge): void

  Add an edge (interaction) to the graph.

  #### Parameters

  - edge: InteractionEdge

  #### Returns void

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:262

### getNodes

- getNodes(): string[]

  Get all nodes in the graph.

  #### Returns string[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:267

### getEdges

- getEdges(): InteractionEdge[]

  Get all edges in the graph.

  #### Returns InteractionEdge[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:272

### getOutgoingEdges

- getOutgoingEdges(agentId: string): InteractionEdge[]

  Get edges from a specific agent.

  #### Parameters

  - agentId: string

  #### Returns InteractionEdge[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:277

### getIncomingEdges

- getIncomingEdges(agentId: string): InteractionEdge[]

  Get edges to a specific agent.

  #### Parameters

  - agentId: string

  #### Returns InteractionEdge[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:282

### getDegreeCentrality

- getDegreeCentrality(): Map<string, number>

  Calculate degree centrality for all nodes.

  #### Returns Map<string, number>

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:287

### getStronglyConnectedComponents

- getStronglyConnectedComponents(): string[][]

  Find strongly connected components.

  #### Returns string[][]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:292

### getEdgeCount

- getEdgeCount(from: string, to: string): number

  Get edge count between two agents.

  #### Parameters

  - from: string
  - to: string

  #### Returns number

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:297

### clear

- clear(): void

  Clear the graph.

  #### Returns void

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:302