Action that generates SVG network graphs including force-directed layouts, decision trees, and radial networks.

This action provides server-side SVG generation for network visualizations, designed for AI agents and workflows to create publication-quality graphs from structured data.

Example

// Force-directed network example
await runAction({
ActionName: 'Create SVG Network',
Params: [
{ Name: 'NetworkType', Value: 'force' },
{ Name: 'Nodes', Value: JSON.stringify([
{ id: '1', label: 'Node A', group: 'A' },
{ id: '2', label: 'Node B', group: 'B' },
{ id: '3', label: 'Node C', group: 'A' }
]) },
{ Name: 'Edges', Value: JSON.stringify([
{ source: '1', target: '2', weight: 1, directed: true },
{ source: '2', target: '3', weight: 0.5 }
]) },
{ Name: 'ShowLabels', Value: 'true' },
{ Name: 'ShowLegend', Value: 'true' }
]
});

// Decision tree example
await runAction({
ActionName: 'Create SVG Network',
Params: [
{ Name: 'NetworkType', Value: 'tree' },
{ Name: 'Nodes', Value: JSON.stringify({
id: 'root',
label: 'Decision',
children: [
{ id: '1', label: 'Option A', value: 0.6 },
{ id: '2', label: 'Option B', value: 0.4 }
]
}) }
]
});

Hierarchy (view full)

Constructors

Methods

  • Generates an SVG network graph from the provided data and configuration

    Parameters

    • params: RunActionParams<any>

      The action parameters containing:

      • NetworkType: Type of network ('force' | 'tree' | 'radial')
      • Nodes: JSON array or object of nodes
      • Edges: JSON array of edges (for force and radial)
      • Physics: Physics parameters (charge, linkDistance, iterations)
      • ShowLabels: Show node labels (default: true)
      • ShowLegend: Show group legend (default: false)
      • NodeShape: Shape for tree nodes ('rect' | 'circle' | 'pill')
      • Width: Width in pixels (optional, default: 800)
      • Height: Height in pixels (optional, default: 600)
      • Title: Network title (optional)
      • Palette: Color palette name (optional)
      • Seed: Random seed for deterministic layouts (optional)

    Returns Promise<SVGActionResult>

    A promise resolving to an SVGActionResult

  • Executes the action with the provided parameters.

    Parameters

    • params: RunActionParams<any>

      The action execution parameters including context

    Returns Promise<ActionResultSimple>

    Promise resolving to the action result

  • Adds a legend to the SVG

    Parameters

    • doc: Document
    • svg: SVGElement
    • groups: string[]
    • groupColorMap: Map<string, string>
    • vb: {
          height: number;
          width: number;
          x: number;
          y: number;
      }
      • height: number
      • width: number
      • x: number
      • y: number
    • font: {
          family: string;
          size: number;
      }
      • family: string
      • size: number

    Returns void

  • Renders a force-directed network using d3-force

    Parameters

    • params: RunActionParams<any>
    • viewBox: ViewBox
    • branding: Branding
    • title: string
    • seed: number
    • showLabels: boolean
    • showLegend: boolean
    • enableTooltips: boolean
    • enablePanZoom: boolean
    • showZoomControls: boolean
    • warnings: string[]

    Returns Promise<string>

  • Renders a radial network using d3-force with radial constraint

    Parameters

    • params: RunActionParams<any>
    • viewBox: ViewBox
    • branding: Branding
    • title: string
    • seed: number
    • showLabels: boolean
    • enableTooltips: boolean
    • enablePanZoom: boolean
    • showZoomControls: boolean
    • warnings: string[]

    Returns Promise<string>