# Adjacency matrix

> Use an adjacency matrix to show who links to whom in a dense network: one row and one column per node, a filled cell for each link, and reordering to reveal clusters. Takes the example's Eurovision votes or any { rows, cols, layers: [{ name, matrix }] }, with a button per layer.

- Data type: Movement between stages (`flow`)
- Free (MIT): install with `npx chartreuse add adjacency-matrix`, or registry item `/r/adjacency-matrix.json`
- Example: **Neighbours still trade Eurovision's top marks: Greece and Cyprus gave each other 12** (Points from each voting country to each finalist, Eurovision Song Contest 2026 grand final)
- How to read it: Each row is a country giving points and each column a finalist receiving them; darker cells are more points, and the highlighted cells are 12s.
- Interactive: sort
- Phone: Not recommended for mobile (79 labels overlap on a phone) · Video formats: none passed; closest 16:9

## Use it when
- the network is dense, so lines would tangle
- readers must look up any one pair
- reordering rows and columns can reveal blocs or clusters
- any who-to-whom counts (reviews between engineers, trade between regions, messages between teams): pass { rows, cols, layers }; a row and column with the same name is drawn dashed as itself

## Avoid it when
- you want to show paths through the network (use a node-link drawing)
- there are hundreds of nodes
- most cells would be empty and the few links matter (use an arc diagram)

## Fields (data.json)
- `finalists` (category): the 25 countries in the grand final (columns)
- `televoters, juryVoters` (category): the countries voting (rows); the televote adds the Rest of the World
- `tele, jury` (number, unit "points", format count): matrix[row][column]: points given, 0 to 12
- `totals` (number, unit "points", format count): each finalist's jury, televote and total points

Units are the example's: with your own data, set each number field's `unit` and `format` (percent, count, decimal, currency, compact) in the meta you pass to mount, or `chartreuse render --unit field=text --format field=count`. Scales and labels follow your data.

## Interactions, motion, sound
- hover or tap a cell to read the points one country gave another
- switch between televote and jury
- reorder by neighbours, by points received, or alphabetically
- Motion: Cells fade in row by row; reordering slides every row and column to its new place.
- Sound: A whoosh on each reorder; a pop on hover pitched by points. Quiet while it draws and between steps; mute it from its card. (sound is off until the viewer turns it on)

## Example spec
```json
{
  "chart": "adjacency-matrix",
  "title": "Neighbours still trade Eurovision's top marks: Greece and Cyprus gave each other 12",
  "subtitle": "Points from each voting country to each finalist, Eurovision Song Contest 2026 grand final",
  "data": "/charts/adjacency-matrix.data.json"
}
```

## Source
Eurovision Song Contest 2026: detailed voting results of the final, Wikipedia, citing the European Broadcasting Union (CC BY-SA 4.0), retrieved 2026-12-01: https://en.wikipedia.org/wiki/Eurovision_Song_Contest_2026

Note: Dashed cells are a country's own column: no country can vote for itself. "Order: neighbours" pulls together rows and columns that give and receive points from each other; it is a simple seriation, not a statistical test of blocs.

Inspired by: [Les Misérables co-occurrence](https://bost.ocks.org/mike/miserables/), Mike Bostock (linked, not copied).

Live: /charts/adjacency-matrix · Manifest: /charts/adjacency-matrix.json · Tags: matrix, network, who links to whom, reorderable, Eurovision, music, voting blocs
