Sociogram
About sociograms
A sociogram maps the web of choices, rejections, and alliances within a group — who likes whom, who is isolated, where cliques form. Jacob Moreno introduced the method in 1934 as a clinical tool for group therapy; it has since been adopted by classroom teachers (who use it to detect exclusion and bullying), HR teams (informal influence mapping), and organizational researchers. Unlike an ecomap, which centers on one person's external environment, a sociogram treats every member of the group symmetrically.
Schematex follows the Moreno (1934) sociometry conventions for node roles and edge types, extended with modern social network analysis notations for valence, direction, and weight. This page documents what the parser accepts today.
1. Your first sociogram
The smallest useful sociogram: four people, three different relationship types.
Four rules cover 80% of usage:
- Start with the keyword
sociogram, optionally followed by a quoted title. - Each person is a node — declared explicitly with
id [label: "…"]or auto-created the first time they appear in an edge. - Connect two nodes with an edge operator —
<->(mutual),->(one-way),-x>(rejection),-.-(neutral). See §3. - Optionally declare groups and config lines to control layout and coloring.
Comments must start with
#on their own line.
2. Nodes
A node line is id [attr: value, …]. Nodes are also created implicitly when first referenced in an edge — but explicit declaration lets you set labels, groups, and roles.
ID rules. Must match [a-zA-Z][a-zA-Z0-9_-]*. The ID is used internally; the label: attribute sets the display name.
Node attributes:
| Attribute | Values | Effect |
|---|---|---|
label: "…" | quoted string | Display name (defaults to the ID) |
group: id | group ID | Associates the node with a group for coloring |
role: … | star, isolate, bridge, neglectee, rejected | Explicit sociometric role annotation |
size: … | small, medium, large | Node size override |
3. Edges
An edge line is leftId OP rightId optionally followed by [label: "…", weight: N]. Both IDs are auto-registered as nodes if not yet declared.
3.1 Direction and valence
| Operator | Direction | Valence | Meaning |
|---|---|---|---|
A -> B | one-way | positive | A chose B |
A <- B | one-way | positive | B chose A (same as B -> A) |
A <-> B | mutual | positive | Both chose each other |
A -- B | undirected | positive | Relationship known; direction not recorded |
A -x> B | one-way | negative | A rejects B |
A <x- B | one-way | negative | B rejects A |
A <x-> B | mutual | negative | Mutual rejection |
A -x- B | undirected | negative | Conflict; direction unknown |
A -.> B | one-way | neutral | A is indifferent toward B |
A <.-> B | mutual | neutral | Mutual indifference |
A -.- B | undirected | neutral | Neutral relationship |
3.2 Weight / strength
Higher weight = thicker line. Use the shorthand operators or override explicitly with [weight: N].
| Weight | Shorthand | Direction | Meaning |
|---|---|---|---|
| 2 (default) | -> <-> -- -x> -.- | any | Standard connection |
| 3 | ==> <== <==> === | one-way / mutual / undirected | Strong |
| 4 | ===> <=== <===> | one-way / mutual | Very strong |
| custom | [weight: N] | — | Any integer |
3.3 Edge labels
A -> B [label: "best friend"] — the label appears on the connecting line.
4. Groups
A group block collects nodes into a named subgroup for coloring and layout clustering.
Group syntax:
group id [label: "…", color: "#hex"]— the group header line.- Member lines follow, each indented at least 4 spaces, one node per line.
- A non-indented line (or the next
group) closes the current group. - Members can carry their own props:
anna [label: "Anna K.", size: large].
Nodes can also be assigned inline: alice [group: girls].
5. Configuration
config: lines tune layout and visual encoding. Each is its own line.
| Config key | Values | Default | Effect |
|---|---|---|---|
layout | circular, force-directed, concentric | circular | Placement algorithm |
sizing | uniform, in-degree, betweenness | uniform | Node size by metric |
coloring | default, group, role | default | Node color scheme |
highlight | comma list: stars, isolates, cliques | stars,isolates | Which patterns to annotate |
Layout notes:
circular— nodes evenly spaced on a ring. Best for small groups (≤15).force-directed— spring model; clusters emerge automatically. Best for medium-sized groups with distinct subgroups.concentric— inner rings hold high-in-degree nodes. Best for showing core-periphery structure.
Circular — uniform ring placement; every node equally visible. Best for small, tightly-knit groups.
Force-directed — spring physics pulls connected nodes together and pushes disconnected ones apart. Subgroups cluster organically.
Concentric — nodes sorted by in-degree; high-centrality nodes appear on inner rings, peripheral nodes on outer rings.
6. Sociometric roles
The parser stores role annotations on nodes. The renderer uses them to apply visual badges — a star marker for star, a dashed border for isolate, and so on.
| Role | Meaning |
|---|---|
star | Central figure chosen by many (high in-degree) |
isolate | No connections in or out |
neglectee | Reaches out to others but receives no choices |
rejected | Receives rejection edges from multiple members |
bridge | Connects two otherwise separate clusters |
7. Labels & comments
- Title:
sociogram "Study group"— first line only. - Node label:
alice [label: "Alice K."]. - Group label:
group boys [label: "Boys"]. - Edge label:
alice -> bob [label: "lab partners"]. - Comments:
#at the start of a line (after leading whitespace).
8. Reserved words & escaping
Reserved at line start: sociogram (header), group, config:.
Reserved operator tokens — avoid these sequences inside IDs: ->, <-, <->, --, ===, ==>, <==, <===>, -x>, <x-, -x-, <x->, -.>, <.->, -.-.
Strings with spaces must be double-quoted in label: and color: values.
9. Common mistakes
| You wrote | Parser says | Fix |
|---|---|---|
tom; jack; mike on one group line | tom; fails the ID regex — silently ignored | One node per line, each indented ≥4 spaces |
| Group members indented 2 spaces | Not treated as group members (parser requires ≥4) | Use 4+ spaces indent |
alice <> bob | No matching operator — not parsed as an edge | Use <-> for mutual positive |
config: layout = grid | Unknown value silently ignored; layout stays circular | Use circular, force-directed, or concentric |
Node with a space in the ID: dr park | Parser takes dr as the ID and park as a stray token | Use underscore: dr_park [label: "Dr. Park"] |
10. Grammar (EBNF)
document = header (blank | comment | config | group-block | edge | node)*
header = "sociogram" ( WS quoted-string )? NEWLINE
quoted-string = '"' any-char-but-quote* '"'
config = "config:" WS key WS "=" WS value NEWLINE
key = "layout" | "sizing" | "coloring" | "highlight"
group-block = "group" WS id ( "[" group-attrs "]" )? NEWLINE
( INDENT≥4 member-line )*
member-line = id ( "[" node-attrs "]" )? NEWLINE
group-attrs = group-attr ("," group-attr)*
group-attr = "label:" quoted-string | "color:" quoted-string
node = id ( "[" node-attrs "]" )? NEWLINE
node-attrs = node-attr ("," node-attr)*
node-attr = "label:" quoted-string
| "group:" id
| "role:" role
| "size:" ("small" | "medium" | "large")
edge = id WS op WS id ( "[" edge-attrs "]" )? NEWLINE
edge-attrs = edge-attr ("," edge-attr)*
edge-attr = "label:" quoted-string | "weight:" number
op = // positive
"<===>" | "===>" | "<==="
| "<==>"|"==>"|"<=="
| "===" | "<->" | "->" | "<-" | "--"
// negative
| "<x->" | "-x>" | "<x-" | "-x-"
// neutral
| "<.->" | "-\.>" | "-.-"
role = "star" | "isolate" | "bridge" | "neglectee" | "rejected"
id = [a-zA-Z] [a-zA-Z0-9_-]*
comment = "#" any NEWLINEAuthoritative source: src/diagrams/sociogram/parser.ts. If this diverges from the parser, the parser wins — please open an issue.
11. Standard compliance
Schematex sociograms follow Moreno (1934) sociometry conventions for node roles (star, isolate, neglectee) and directed-choice semantics. The edge operator set is extended with valence (positive / negative / neutral) and weight levels following modern social network analysis practice (Hanneman & Riddle, 2005).
What is implemented today:
- ✅ Directed, mutual, and undirected edges
- ✅ Positive, negative, and neutral valence operators
- ✅ Four weight levels (1–4) with shorthand operators and
[weight: N] - ✅ Groups with color
- ✅ Node role declarations (
star,isolate,bridge,neglectee,rejected) - ✅ Three layouts: circular, force-directed, concentric
- ✅ Three sizing modes: uniform, in-degree, betweenness
- ⏳ Auto-detected clique highlighting — shaded convex hull (see §13)
- ⏳ Social atom view (ego-centered layout)
References:
- Moreno, J.L. (1934). Who Shall Survive? Foundations of Sociometry, Group Psychotherapy and Sociodrama. Beacon House.
- Hanneman, R.A. & Riddle, M. (2005). Introduction to Social Network Methods. UC Riverside.
12. Related examples
13. Roadmap
Planned — not yet parseable. Do not use these in generated DSL today; the parser will reject or ignore them.
- Auto-detected clique highlighting — shaded convex hull drawn around mutual-choice subgroups of ≥3.
- Bridge auto-detection —
role: bridgeinferred from betweenness centrality without explicit declaration. - Social atom view — ego-centered layout where one nominated node sits at the center.
- Reciprocity matrix export — structured table output alongside the diagram.
Track in the GitHub issues if you need any of these sooner.