Created from react-d3-starter template
Star Wars Character Interaction Network
An interactive force-directed network visualization of character interactions across the Star Wars films, built with React and D3.
Dataset Overview
- Filename:
starwars_edges.csv - Rows: 1000
- Columns: 4
- Subject matter: A weighted directed edge list. Each row appears
to represent one interaction (e.g., a line of dialogue) directed from
a
sourcecharacter to atargetcharacter within a givenepisode. Thevaluecolumn appears to be a count or weight of how often that interaction occurs.
Note: The exact semantic meaning of
source,target, andvalueis inferred from the column names and structure. It is described here as tentative rather than established fact.
Column Descriptions
episode
- Represents: The Star Wars film (episode number) in which the interaction occurs.
- Munzner type: Ordinal — the values are ordered episode numbers. Computed cardinality is 8 with min 1 and max 7 (one value may be a variant/parsing artifact; treat the exact set as tentative).
- Missing values: None reported.
- Notes: Stored as a boolean type by the profiler, which likely reflects a detection quirk rather than its true meaning; treated here as an ordinal numeric episode identifier.
source
- Represents: The character initiating the interaction (the speaker or actor of the edge), by name / identifier.
- Munzner type: Nominal — unordered character identifiers.
- Missing values: None reported. Cardinality is 83.
target
- Represents: The character receiving the interaction, by name / identifier.
- Munzner type: Nominal — unordered character identifiers.
- Missing values: None reported. Cardinality is 93.
value
- Represents: The weight or count of the interaction between the source and target (e.g., number of exchanges).
- Munzner type: Quantitative — a numeric measurement.
- Missing values: None reported. Range is 1 to 77, mean ~4.126.
- Notes: Small positive integers only.
Visualization Mappings
Chart type: Force-directed network (node-link diagram) of the directed interaction graph.
- Nodes: Every distinct character appearing as a
sourceortarget. Node size encodes the character's total interaction weight (sum ofvalue) in the currently selected view. - Edges: One link per dataset row, drawn as directed curved arrows
from
sourcetotarget. - Edge width: Encodes
value(interaction weight). - Edge opacity: Encodes
valueso weak interactions recede. - Color: Edges are colored by the source character's community / rank to aid legibility; hovered and highlighted edges are emphasized.
- Interaction:
- An episode selector filters which edges are shown (or shows all episodes combined). This is the primary interaction, since the graph is otherwise a dense hairball.
- Hovering an edge highlights it and its two endpoints, dimming everything else; a tooltip shows source → target and the value.
- The layout is responsive to its container via a resize observer.
Why this design: The data is fundamentally a weighted directed graph, so a node-link diagram is the most faithful and information-rich representation. Encoding weight in edge width and node size surfaces the strongest relationships, while episode filtering tames the density of 1000 edges into comprehensible per-film views.
Files
index.html— page shell and import map (React + D3 from CDN).index.jsx— mounts<App />.App.jsx— loadsdata/starwars_edges.csv, holds episode filter state, and renders the visualization.viz.js— D3 force-directed network render entry point.useContainerDimensions.js— tracks container size for responsiveness.styles.css— page styles.README.md— this file.
Getting started
The app loads data/starwars_edges.csv at runtime. Use the episode
selector at the top to explore interactions per film, and hover edges
to inspect individual character relationships.
Visualization Ideas
No project brief was provided, so these ideas are framed by the
README's stated goal: helping viewers understand who interacts with
whom across the Star Wars films, and how that changes by episode.
All ideas use only starwars_edges.csv (episode, source, target,
value) and starwars_nodes.csv (episode, name, value,
colour).
Episode Small Multiples of the Network
- Main question: How does the interaction structure differ from film to film?
- Data fields:
episode,source,target,value. - Visual encoding: One small force-directed graph per episode in a grid, with a shared node-size and edge-width scale.
- Interaction/annotation: Hovering a character highlights them in every panel; click a panel to enlarge it.
- Implementation note: Group edges by
episode, run one simulation per group, and reuse the existing scales.
Adjacency Matrix of Interactions
- Main question: Which source-target pairs interact most, without edge clutter?
- Data fields:
source,target,value. - Visual encoding: Rows are sources and columns are targets; cell color is the summed
value, sorted by total weight. - Interaction/annotation: Hover a cell for a tooltip; toggle the sort order (alphabetical, weight).
- Implementation note: Use d3.rollup on the
source|targetpair and a band scale with a sequential color scale.
Top Characters Bar Chart
- Main question: Who are the most talkative or most addressed characters?
- Data fields:
source,target,value. - Visual encoding: Horizontal bars of total outgoing
value, with a paired bar for incoming. - Interaction/annotation: A toggle switches between out, in, and total; clicking a bar focuses that character in the network.
- Implementation note: Roll up sums by
sourceand bytarget, then slice the top N.
Chord Diagram of Main Characters
- Main question: How is interaction weight distributed among the top characters?
- Data fields:
source,target,value. - Visual encoding: Arcs sized by total weight, with ribbons between pairs sized by
value. - Interaction/annotation: Hovering an arc fades unrelated ribbons.
- Implementation note: Build a square matrix for the top ~15 characters with d3.chord and d3.ribbon.
Episode-by-Character Heatmap
- Main question: Which characters are prominent in which films?
- Data fields:
episode,name,value(nodes file). - Visual encoding: Rows are characters, columns are episodes, and color is node
value. - Interaction/annotation: Tooltip with exact value; sort rows by the selected episode.
- Implementation note: Load starwars_nodes.csv and pivot by name and episode, leaving missing cells empty.
Bump Chart of Character Rank
- Main question: How does each character's rank change across episodes?
- Data fields:
episode,name,value. - Visual encoding: Lines connecting rank positions per episode, with endpoint dots.
- Interaction/annotation: Click a line to highlight it and mute the others.
- Implementation note: Rank by
valuewithin each episode and keep the top 10 overall.
Sankey of Speaker to Listener
- Main question: Where does a selected episode's interaction flow go?
- Data fields:
source,target,value,episode. - Visual encoding: Source nodes on the left and target nodes on the right, with link width equal to
value. - Interaction/annotation: The episode dropdown filters flows; hover shows the pair.
- Implementation note: Use d3-sankey (add it to the import map) and prefix node ids with side to avoid cycles.
Arc Diagram with Linear Ordering
- Main question: Which relationships span far apart in a meaningful ordering?
- Data fields:
source,target,value. - Visual encoding: Nodes on a line ordered by total weight; arcs with thickness by
value. - Interaction/annotation: Hovering a node highlights its arcs.
- Implementation note: Use a point scale and draw semicircle paths between positions.
Reciprocity Scatterplot
- Main question: Are interactions balanced between pairs, or one-sided?
- Data fields:
source,target,value. - Visual encoding: Each unordered pair is a point, with A→B on x and B→A on y, plus a diagonal reference line.
- Interaction/annotation: Label the outliers; hover for the pair names.
- Implementation note: Aggregate directed pair sums and join each pair with its reverse, using 0 where missing.
Value Distribution Histogram
- Main question: Are most interactions small with a few heavy ones?
- Data fields:
value,episode. - Visual encoding: A histogram, optionally on a log scale, with a faceted or stacked option by episode.
- Interaction/annotation: Brush a value range to filter the network.
- Implementation note: Use d3.bin with thresholds; the range is 1 to 77.
Ego Network Focus View
- Main question: Who does one chosen character talk to and hear from?
- Data fields:
source,target,value,episode. - Visual encoding: Radial layout with the chosen character at the center, neighbors placed by angle, and distance inversely related to
value. - Interaction/annotation: A searchable character picker; clicking a neighbor re-centers on it.
- Implementation note: Filter edges where the character is source or target, then compute polar coordinates.
Stacked Area of Total Interaction per Episode
- Main question: How much interaction does each film contain, and who contributes?
- Data fields:
episode,source,value. - Visual encoding: Stacked bars per episode, with segments for the top sources and an "other" group.
- Interaction/annotation: Hover a segment for the character and value.
- Implementation note: Roll up by episode and source, and use d3.stack.
Node-Colour Legend Network
- Main question: Do the dataset's
colourgroupings correspond to structural clusters? - Data fields:
name,colour,episode,source,target. - Visual encoding: Network nodes filled with the
colourvalue from the nodes file, with a legend of the distinct colours. - Interaction/annotation: Click a legend swatch to isolate that group.
- Implementation note: Join nodes to graph nodes by
nameandepisode; the legend meaning is unknown, so label swatches neutrally.
- Main question: Do the dataset's
Degree vs Weight Scatterplot
- Main question: Are some characters connected to many others, or do they interact heavily with a few?
- Data fields:
source,target,value. - Visual encoding: x is the number of distinct partners, y is total
value, and point size is the number of episodes. - Interaction/annotation: Label the top points and brush to select.
- Implementation note: Compute a Set of neighbors and the sum per character.
Edge Timeline Strip Plot
- Main question: In which films does each pair interact?
- Data fields:
episode,source,target,value. - Visual encoding: Rows are the top pairs, x is episode, and circle size is
value. - Interaction/annotation: Hover for the pair and value; sort by total.
- Implementation note: Use a point scale for episodes and a band scale for pairs.
Treemap of Weight by Character
- Main question: What share of all interaction does each character hold?
- Data fields:
episode,name,value(nodes file). - Visual encoding: Nested rectangles grouped by episode, sized by
value. - Interaction/annotation: Click an episode to zoom in.
- Implementation note: Build a d3.hierarchy from the grouped nodes and use d3.treemap.
Slope Chart Comparing Two Episodes
- Main question: Which characters gain or lose prominence between two chosen films?
- Data fields:
episode,name,value. - Visual encoding: Two vertical axes with lines between them, colored by rise or fall.
- Interaction/annotation: Two dropdowns choose the episodes; hover to highlight a line.
- Implementation note: Join nodes by name across the two episodes and handle characters missing from one.
Edge Weight Rank Lollipop Chart
- Main question: What are the strongest individual relationships?
- Data fields:
source,target,value,episode. - Visual encoding: Sorted lollipops labeled "A → B", colored by episode.
- Interaction/annotation: Episode filter; click to highlight the edge in the network.
- Implementation note: Sort rows by
valueand slice the top 20.
Network Evolution Animation
- Main question: How does the cast graph grow and shift from one film to the next?
- Data fields:
episode,source,target,value. - Visual encoding: The existing network with animated transitions between episodes, keeping node positions stable.
- Interaction/annotation: Play/pause and a step slider; new nodes pulse on entry.
- Implementation note: Keep one persistent node map and update the data join instead of clearing the SVG.
Linked Overview and Detail Dashboard
- Main question: How do the global patterns relate to a single selected character or film?
- Data fields: all fields across both files.
- Visual encoding: A coordinated layout with the network, a top-character bar chart, and an episode histogram.
- Interaction/annotation: Selecting in any view filters the others, with a reset button.
- Implementation note: Lift selection state into App.jsx and pass it to each view.
Comments
Sign in to join the discussion.