Viewing a saved revision (read-only)
6aq0kfVTN5d7HGl4o7vcU
Created from react-d3-starter template
Star Wars Edges (Episode Character Interactions)
Dataset Overview
- Filename:
starwars_edges.csv - Virtual path:
/data/starwars_edges.csv - Rows: 1,000 (as reported by the upload profile)
- Columns: 4
- File size: ~21 KB
The dataset is an edge list / weighted co-occurrence table. Each row appears to
describe a directed relationship between two named characters (source →
target) observed within a specific Star Wars episode (episode), along with a
numeric strength or frequency (value). Typical of network analysis datasets,
the pair of character names defines a graph edge and value weights that edge.
The episode column is documented in the profile as a boolean type, but its
observed values (integers 1 through 7) look like ordinal episode numbers rather
than true booleans. This is a tentative interpretation — the underlying schema
was not verified against an external source.
Column Descriptions
| Column | Apparent meaning | Munzner type | Missing | Notes |
|---|---|---|---|---|
episode |
Numeric label identifying which Star Wars film the edge was observed in (1–7). | Ordinal (ordered categories) — though the profile labels it boolean, the observed values are integers 1–7. | 0 | Values range 1–7. Interpreted as movie ordering (release order), not a boolean. |
source |
Name of the character the edge originates from. | Nominal (unordered categories). | 0 | 83 distinct names. Uppercase, may contain spaces, punctuation, and hyphenation (e.g. QUI-GON, OBI-WAN, NUTE GUNRAY). |
target |
Name of the character the edge points to. | Nominal (unordered categories). | 0 | 93 distinct names. Same formatting conventions as source. |
value |
Numeric weight or count associated with the directed edge (e.g. number of interactions or shared scenes). | Quantitative (numeric measurement; positive integers). | 0 | 42 distinct values, min 1, max 77, mean ≈ 4.13. Assumed non-negative integers. |
Parsing / data assumptions
- The CSV header is the first record and is parsed with D3's
csv()parser (RFC 4180 compliant, handles quoted cells and embedded newlines). Column keys are used verbatim:episode,source,target,value. episodeandvalueare coerced to numbers at load time with+d.episodeand+d.value. Any non-numeric value would becomeNaNand is filtered out in the loading step before visualization.- Character names are kept as raw strings; no case-folding or whitespace
normalization is applied, since distinct names like
R2-D2vsR2D2may be meaningful. - The profile calls
episodea boolean, but no boolean values are present in the sample; treat the "boolean" label as an artifact of the upload profiler's type detection for small integer columns.
Visualization Mappings
Chart type: horizontal bar chart of the top-N characters by total edge
weight (sum of value across all rows where the character appears, either as
source or target).
Why this design: The dataset is a weighted edge list. The most immediately useful summary question is "which characters dominate the interaction graph?" Summing edge weights per character gives a compact, readable ranking that reveals the hubs of the network without introducing a heavy graph layout.
Encodings
- Y position (bars): character name — Nominal → ordinal scale.
- X length: total aggregated weight for that character — Quantitative linear scale.
- Bar label (end of bar): exact numeric total, formatted with thousands separators.
- Color: single accent color with no data meaning (avoids encoding a second redundant channel).
Interactions
- Hover on a bar: highlights the bar and shows a tooltip with the character name, total weight, and the number of distinct episodes in which the character appears.
- Top-N selector (5 / 10 / 15 / 25): re-truncates the ranked list without re-loading the dataset, letting the user zoom in on the head or the long tail.
Responsiveness: The container uses useContainerDimensions (ResizeObserver)
so the SVG re-renders on resize; bar height and axis widths are recomputed from
the live pixel dimensions.
Implementation Notes
- Data is loaded at runtime from
/data/starwars_edges.csvviad3.csv. - Rows with non-finite
episodeorvalueare dropped defensively. - Files:
index.html,index.jsx,App.jsx,viz.js,useContainerDimensions.js, andstyles.cssimplement the React + D3 shell and the bar chart.
Visualization Ideas
No project brief was provided, so the framing is taken from the current visualization, a "Character Interaction Ranking" bar chart. The implied audience is general viewers and fans exploring the data. The implied question is "who dominates the interaction network, and how does that change across episodes?" Every idea uses only episode, source, target, and value. Load data at runtime with d3.csv('data/starwars_edges.csv') and coerce episode and value to numbers.
Episode-Faceted Top Characters (small multiples)
- Question: Do the top-ranked characters change from episode to episode?
- Fields:
episode,source,target,value. - Encoding: Seven small horizontal bar charts, one per episode, using the same x scale and the same highlight color as the current chart.
- Interaction: Hovering a character highlights that character's bar in every facet.
- Implementation: Use
d3.rollupby episode then character, summingvaluefor both source and target. ReuserenderBarsper facet.
Stacked Bar by Episode Contribution
- Question: Which episodes produce each top character's total weight?
- Fields:
episode,source,target,value. - Encoding: Horizontal stacked bars; each segment is an episode, colored by a sequential or ordinal palette.
- Interaction: The tooltip shows the per-episode breakdown. Clicking a legend swatch isolates one episode.
- Implementation: Pivot into
{name, e1..e7}and used3.stack. This extends the existing ranking.
Character × Episode Heatmap
- Question: In which episodes is each character most active?
- Fields:
episode,source,target,value. - Encoding: Rows are characters ordered by total weight; columns are episodes 1–7. Cell color is a sequential scale of summed
value. - Interaction: Hover shows the exact value. Clicking a row label re-sorts by that character's activity.
- Implementation: Use
scaleBandfor both axes andscaleSequential(interpolateYlOrBr).
Chord Diagram of Top Characters
- Question: Which pairs of major characters interact most strongly?
- Fields:
source,target,value. - Encoding: Arcs for the top 15 characters; ribbon width is the summed pair weight.
- Interaction: Hovering an arc fades the unrelated ribbons.
- Implementation: Build a square matrix and use
d3.chordDirected. Group the remaining characters as "Other".
Force-Directed Network
- Question: What is the overall structure of the interaction graph, including its hubs and clusters?
- Fields:
source,target,value. - Encoding: Node size is weighted degree; link thickness and opacity are
value. - Interaction: Drag nodes, click to pin one, and use an episode filter to rebuild the graph.
- Implementation: Use
d3.forceSimulationwithforceLinkandforceManyBody. Aggregate duplicate edges first.
Episode Slider with Animated Bar Race
- Question: How does the ranking evolve from Episode 1 to 7?
- Fields:
episode,source,target,value. - Encoding: The existing bar chart animates re-sorting as the episode changes; the bar color is constant.
- Interaction: Play/pause button and a scrubber over episodes; optionally switch to cumulative totals.
- Implementation: Precompute rankings per episode and use transitions keyed by name.
Directed Adjacency Matrix
- Question: Who initiates versus receives interactions with whom?
- Fields:
source,target,value. - Encoding: Rows are sources and columns are targets. Cell color encodes
value. Rows and columns are ordered by a clustering heuristic. - Interaction: Crosshair highlighting and a tooltip showing both directions of a pair.
- Implementation: Pivot the data into a Map keyed by
source|targetand render rects.
Source vs. Target Diverging Bars
- Question: Is a character mostly a source or mostly a target of interactions?
- Fields:
source,target,value. - Encoding: Bars extend left for out-weight (as source) and right for in-weight (as target), around a central axis.
- Interaction: Toggle the sort between total, out-heavy, and in-heavy.
- Implementation: Two rollups by
sourceand bytarget; use a symmetric x domain.
Out- vs. In-Weight Scatterplot
- Question: Which characters are hubs, which are broadcasters, and which are receivers?
- Fields:
source,target,value. - Encoding: x is out-weight and y is in-weight. Point size is the number of distinct partners. A diagonal reference line marks balance.
- Interaction: Hover for details, label the outliers, and brush to select a group.
- Implementation: Compute the metrics with
d3.rollupand used3.brush.
Edge Weight Distribution Histogram
- Question: Are interaction weights heavy-tailed or evenly spread?
- Fields:
value(andepisodefor an optional filter). - Encoding: A histogram of
valuebins, optionally on a log y-axis. - Interaction: A brush selects a range of weights and lists the matching edges. Toggle linear/log.
- Implementation:
d3.binonvalue. The file has about 42 distinct values, so use integer thresholds.
Ridgeline of Weight Distribution per Episode
- Question: Does the typical edge weight differ across episodes?
- Fields:
episode,value. - Encoding: One density curve per episode, stacked vertically with a shared x axis.
- Interaction: Hover shows the episode median and count.
- Implementation: Use kernel density estimation (a custom function) per episode and
d3.areawith overlapping bands.
Episode Activity Overview (line or area)
- Question: How much total interaction weight and how many edges does each episode contain?
- Fields:
episode,value. - Encoding: An area or line chart across ordinal episodes 1–7. The primary series is total weight; a second panel or dashed line shows the edge count.
- Interaction: Clicking an episode filters the main ranking chart.
- Implementation:
d3.rollupby episode, then link it to App state asselectedEpisode.
Slope Chart of Rank Change
- Question: Which characters rise or fall in rank between two chosen episodes?
- Fields:
episode,source,target,value. - Encoding: Two vertical axes of ranked names joined by lines. Color shows rank up, down, or unchanged.
- Interaction: Dropdowns choose the two episodes. Hovering a line highlights that character.
- Implementation: Compute the per-episode ranking and join by name. Characters absent from an episode get a dashed stub.
Treemap of Interaction Weight
- Question: What share of total weight does each character hold?
- Fields:
source,target,value. - Encoding: Rectangle area is total weight. A hierarchy of episode → character gives nested rectangles, colored by episode.
- Interaction: Click to zoom into an episode; breadcrumb navigation returns to the top.
- Implementation:
d3.hierarchyandd3.treemapwith an aggregated tree.
Ego Network Focus View
- Question: Who does a chosen character interact with, and how strongly?
- Fields:
source,target,value,episode. - Encoding: A radial layout with the chosen character at the center and neighbors on a ring. Distance or link width encodes
value, and the arrow direction shows source → target. - Interaction: Clicking a bar in the main ranking sets the ego character, and an episode filter narrows it.
- Implementation: Filter edges where the character is source or target and compute a polar position per neighbor.
Arc Diagram of Top Pairs
- Question: Which individual character pairs carry the most weight?
- Fields:
source,target,value. - Encoding: Nodes sit on a line ordered by total weight. Arc height or thickness encodes the pair weight.
- Interaction: Hovering a node reveals its arcs, and a slider sets the minimum edge weight.
- Implementation: Aggregate pairs, take the top N edges, and draw
patharcs with an SVGAcommand.
Top Edges Lollipop Chart
- Question: Which single directed relationships are strongest?
- Fields:
source,target,value,episode. - Encoding: Each row is a "SOURCE → TARGET" label with a lollipop whose length is
value. Dot color encodesepisode(ordinal palette). - Interaction: Filter by episode, and hover for the details.
- Implementation: Sort the rows by
valuedescending and slice the top 20 with no aggregation.
Parallel Coordinates of Character Profiles
- Question: How do characters compare across several derived measures?
- Fields:
source,target,value,episode. - Encoding: One line per character across axes for total weight, out-weight, in-weight, distinct partners, and episodes appeared.
- Interaction: Brushing each axis filters the lines, and hovering names a line.
- Implementation: Compute the per-character metrics and use a
scalePointfor the axes withd3.brushYper axis.
Episode Cohort Overlap (UpSet-style matrix)
- Question: Which characters appear in all episodes, and which in only one or two?
- Fields:
episode,source,target. - Encoding: A dot matrix of episodes (columns) by character-set combinations, with bars above showing the number of characters per combination.
- Interaction: Hovering a combination lists its characters, and a filter limits it to characters above a weight threshold.
- Implementation: Build a Set of episodes per character, key it by the sorted episode list, and count the groups.
Sankey of Source → Target Flow
- Question: How does interaction weight flow from the main sources to the main targets?
- Fields:
source,target,value,episode. - Encoding: Left nodes are sources and right nodes are targets. Link width is summed
value, and link color is the source group. - Interaction: Hovering a link shows the pair and weight. An episode toggle recomputes the flow, and the less common names are grouped as "Other".
- Implementation: Use
d3-sankey, which needs an extra import. Suffix the node ids ("_s", "_t") to keep the two sides distinct.