Skip to content

Force-Directed Graph - Basic Example

A force-directed layout uses physics simulation to position nodes. Hover over nodes to highlight their connections.

View Source
type: force
engine: d3
width: 800
height: 600
title: "Team Collaboration Network"
nodeRadius: 8
linkDistance: 80
chargeStrength: -150

data:
  source: |
    [
      {"source": "Alice", "target": "Bob", "value": 5},
      {"source": "Alice", "target": "Charlie", "value": 3},
      {"source": "Bob", "target": "Diana", "value": 4},
      {"source": "Charlie", "target": "Diana", "value": 2},
      {"source": "Diana", "target": "Eve", "value": 3},
      {"source": "Eve", "target": "Frank", "value": 4},
      {"source": "Frank", "target": "Alice", "value": 2},
      {"source": "Bob", "target": "Eve", "value": 1},
      {"source": "Charlie", "target": "Frank", "value": 2}
    ]

colorScheme: category10

Configuration Options

OptionDescriptionDefault
nodeRadiusSize of node circles5
linkDistanceTarget distance between connected nodes50
chargeStrengthRepulsion force between nodes (negative = repel)-100
collisionRadiusMinimum distance between nodesnodeRadius

Interactions

  • Hover over a node to highlight its direct connections
  • Connected nodes and edges are emphasized while others fade
  • Node labels remain visible for highlighted nodes

Released under the MIT License. Built by Boundary Lab.