Schematex

Sociogram

Social network diagrams with mutual choices, rejections, group coloring, force-directed or hierarchical layout. Auto-detects sociometric roles — stars, isolates, cliques. Based on Moreno sociometry.

Sociogram: Playground Dynamics Sociogram with 7 members and 4 connections Playground Dynamics conflict tom jack mike leo anna beth diana

Moreno (1934) sociometry model + modern social network analysis conventions + 多领域应用扩展。群体内社会关系的可视化与分析。

Primary References:

  • Moreno, J.L. (1934). Who Shall Survive? Foundations of Sociometry, Group Psychotherapy and Sociodrama. Beacon House.
  • Moreno, J.L. & Jennings, H.H. (1938). Statistics of social configurations. Sociometry, 1(3/4), 342-374.
  • Brandes, U. et al. (2011). Effects of sociogram drawing conventions and edge crossings in social network visualization. J Graph Algorithms Appl. 15(1), 157-176.
  • Hanneman, R.A. & Riddle, M. (2005). Introduction to Social Network Methods. UC Riverside.
  • FBI Law Enforcement Bulletin (2014). Social Network Analysis: A Systematic Approach for Investigating.

1. What is a Sociogram?

Sociogram 是由 Jacob L. Moreno 于 1934 年开发的群体社会关系可视化工具。与 ecomap(个人↔外部系统)不同,sociogram 关注的是群体内部成员之间的关系网络——谁选择了谁、谁被孤立、谁是核心、哪些人形成了小圈子。

核心区别:

维度EcomapSociogram
焦点一个人/家庭 vs 外部系统群体内所有成员互相之间
布局径向(中心-外围)网络图(force-directed / circular)
连线含义关系质量(强/弱/压力)社会选择(选择/拒绝/相互)
用途临床评估群体动力学分析

2. Who Uses Sociograms — User Segments

2.1 Education(最大用户群)

教师 + 学校心理咨询师是 sociogram 的第一大用户群。典型场景:

场景方法目的
课堂社交评估让每个学生列出 2 名想合作的同学识别 stars(受欢迎)、isolates(被孤立)、cliques(小圈子)
座位/分组安排基于 sociogram 数据优化确保 isolates 被纳入、打破排他性 cliques
霸凌预防定期 sociogram 追踪发现关系变化、早期干预
夏令营/班级分配师生关系映射平衡组间社交动力

关键词信号: "sociogram classroom"、"sociogram maker"(教师工具意图)

2.2 Clinical / Social Work(专业用户)

社工 + 群体治疗师 + 心理剧治疗师

场景方法目的
Group therapy 动力评估治疗师观察 + 成员问卷识别联盟、冲突、权力结构
Social atom(社会原子)个人画出最重要的人际关系Moreno 的核心技术,warm-up for psychodrama
家庭系统动力家庭成员间的选择/排斥补充 genogram 的动力维度
社区评估机构间关系映射识别服务gap、资源集中度

与 Schematex 现有用户的重叠: 使用 genogram + ecomap 的社工/治疗师也是 sociogram 的天然用户。

2.3 Organizational Development(企业用户)

HR 专家 + 组织发展顾问 + 团队 lead

场景方法目的
非正式影响力映射"你遇到问题会找谁帮忙?"发现隐性领导者 vs 正式 org chart
团队组建跨部门社交网络分析优化跨职能团队组合
信息流分析"你从谁那里获取工作信息?"识别信息瓶颈和孤岛
合并后文化整合两个团队的交叉连接评估整合进度

2.4 Law Enforcement / Intelligence(高价值专业用户)

执法分析师 + 情报分析师

场景方法目的
犯罪网络分析电话记录、社交媒体、监控数据 → link analysis识别组织核心人物、中间人、外围
帮派结构映射逮捕记录、同车记录理解帮派层级和领地
嫌疑人社交圈1-2 度关系网络追踪逃犯、预测行为
反恐网络分析通讯模式 + 资金流识别 cell 结构

注意: 执法场景通常使用 Palantir、i2 Analyst's Notebook 等专业工具,但基础的 sociogram 可视化能力(轻量、可嵌入、Text DSL 输入)是差异化机会。

2.5 Academic Research(长尾用户)

社会学、人类学、政治学研究中的社会网络分析。通常使用 Gephi、NetworkX、Pajek 等重型工具。Schematex 的机会在于轻量快速可视化——论文插图、教学演示。


3. Sociogram Structure

Sociogram 由三层组成:

  1. 节点 (Nodes) — 群体中的个体成员
  2. 连线 (Edges) — 成员之间的社会关系/选择
  3. 结构模式 (Patterns) — 从节点+连线中涌现的群体结构

4. Node Types & Symbols

4.1 Standard Node Shape

ElementShapeSVG含义
Default memberCircle (r=20)<circle>群体中的个体
Star (popular)Circle + star marker<circle> + <polygon> overlay被多人选择的核心人物
IsolateCircle + dashed border<circle stroke-dasharray>无人选择/未选择他人
Ego (focal person)Double circle (concentric)两个 <circle>,gap=3px分析的焦点人物(egocentric 视图)

Auto-detection rules(基于数据自动标记):

  • Star: in-degree ≥ mean + 1.5 × SD,或 in-degree ≥ group_size × 0.4
  • Isolate: in-degree = 0 AND out-degree = 0
  • Neglectee: in-degree = 0 但 out-degree > 0
  • Rejected: 收到 rejection 数 ≥ 2

4.2 Node Sizing

节点大小可以反映社会计量指标:

ModeSize Rule含义
Uniform (default)所有节点相同大小 (r=20)中性展示
By in-degreer = 14 + in_degree × 4 (min: 14, max: 40)越受欢迎越大
By betweennessr = 14 + normalized_betweenness × 26桥接角色越重要越大

DSL: config: sizing = in-degree 或在节点上 [size: large]

4.3 Node Coloring

ModeColor Rule含义
DefaultAll #42A5F5 (blue)中性
By group/category按 group 属性着色区分子组(班级、部门、性别等)
By roleStar=gold, Isolate=gray, Normal=blue突出社会地位
By custom attribute用户自定义任意分类维度

Default color palette for groups (最多 8 组):

group1: #42A5F5 (blue)
group2: #66BB6A (green)
group3: #FFA726 (orange)
group4: #AB47BC (purple)
group5: #EF5350 (red)
group6: #26C6DA (cyan)
group7: #FFEE58 (yellow)
group8: #8D6E63 (brown)

4.4 Node Labels

ElementPositionFont含义
Name/IDBelow node center, 4px gap11px, font-family: sans-serifPrimary identifier
Role badgeTop-right corner9pxOptional: ★ star, ● isolate
DetailsBelow name9px, grayOptional: age, title, etc.

5. Edge Types (Connection Lines)

5.1 Relationship Direction

TypeLine StyleDSL SyntaxSVG含义
One-way choiceArrow →A -> B<line> + marker-end="url(#arrow)"A 选择了 B
Mutual choiceDouble arrow ↔A <-> B<line> + both markers相互选择
UndirectedPlain line —A -- B<line> without markers已知关系,方向未知

5.2 Relationship Valence (正/负)

TypeLine StyleDSL SyntaxSVG含义
Positive/attractionSolid line-> / <-> / --<line> solid, color: #388E3C (green)选择/喜欢/信任
Negative/rejectionDashed red line-x> / <x-> / -x-<line> dashed, color: #D32F2F (red)拒绝/冲突/回避
Neutral/indifferentDotted gray line-.> / <.-> / -.-<line> dotted, color: #9E9E9E (gray)中性/无明确态度

5.3 Edge Weight (Relationship Strength)

WeightLine WidthDSL Syntax含义
Weak (1)1pxA -> B [weight: 1]弱连接
Normal (2, default)2pxA -> B一般连接
Strong (3)3.5pxA -> B [weight: 3]A ==> B强连接
Very strong (4+)5pxA -> B [weight: 4]A ===> B非常强连接

5.4 Edge Labels

A -> B [label: "best friend"]
C -x> D [label: "bullying"]
E <-> F [label: "study partners"]

5.5 Combined DSL Examples

# One-way positive choice
alice -> bob

# Mutual strong positive
alice <==> carol

# One-way rejection
dave -x> eve

# Mutual neutral
frank <.-> grace

# Weighted with label
alice -> bob [weight: 3, label: "trusted advisor"]

6. Structural Patterns (Auto-Detected)

Schematex 应自动检测并可选标注以下经典社会计量结构:

6.1 Individual-Level Patterns

PatternDetection RuleVisual Annotation
Starin-degree ≥ mean + 1.5σGold fill / ★ badge
Isolatein-degree = 0 AND out-degree = 0Dashed border, gray fill
Neglecteein-degree = 0, out-degree > 0Dashed border, blue fill
Rejectedrejection count ≥ 2Red dashed border

6.2 Pair-Level Patterns

PatternDetection RuleVisual Annotation
Mutual pairA→B AND B→AThicker bidirectional line
Asymmetric pairA→B but NOT B→AStandard arrow

6.3 Group-Level Patterns

PatternDetection RuleVisual Annotation
CliqueSubgroup where all members mutually choose each other (≥3 members)Shaded convex hull background
ChainA→B→C→... (unidirectional sequence, no mutual)Sequential arrow path highlighted
BridgeNode connecting two otherwise separate clustersDiamond shape overlay or highlight ring

DSL 控制: config: highlight = stars, isolates, cliques (默认: stars, isolates)


7. Layout Rules

7.1 Layout Algorithm Options

Sociogram 支持多种布局,不同场景适用性不同:

Layout算法适用场景复杂度
Force-directed (default)Fruchterman-Reingold / spring model通用群体网络,自动聚类O(n² × iterations)
Circular均匀排列在圆周上小组(≤15人),强调谁连接了谁O(n)
Concentric按 in-degree 分层圆环强调核心-边缘结构O(n log n)
Group-based按 group 属性分区跨组关系可视化O(n) + force within group

7.2 Force-Directed Layout (Default)

Fruchterman-Reingold 算法实现:

初始化:节点随机放置在画布内
循环 max_iterations 次:
  对每对节点计算 repulsive force (f_rep = k²/d)
  对每条边计算 attractive force (f_att = d²/k)
  更新节点位置(clamp to canvas bounds)
  逐步降低 temperature(模拟退火)
ParameterDefault Value含义
k (optimal distance)sqrt(canvas_area / node_count)节点间理想距离
max_iterations300收敛步数
initial_temperaturecanvas_width / 10初始位移上限
cooling_rate0.95每步温度衰减
min_distance60px节点最小间距(硬约束)

7.3 Circular Layout

角度间隔 = 2π / node_count
第 i 个节点位置:
  x = center_x + radius × cos(i × 角度间隔 - π/2)
  y = center_y + radius × sin(i × 角度间隔 - π/2)
ParameterDefault Value含义
Radiusmax(120, node_count × 20)圆的半径
Start angle-π/2 (12 o'clock)第一个节点的起始位置

排序优化: 按 group 属性聚集相邻位置,减少跨组连线交叉。

7.4 Concentric Layout

按社会地位分层:

Ring 0 (center):  Stars (in-degree 最高)
Ring 1:           Above-average in-degree
Ring 2:           Average in-degree
Ring 3 (outer):   Below-average + isolates
ParameterDefault Value
Ring 0 radius0px (单个 star 放中心) 或 40px (多个)
Ring gap80px
Outer ring radiusring_count × 80px

7.5 Spacing & Canvas Rules

ParameterDefault含义
Node radius20px (uniform)默认节点大小
Min node-to-node gap60px避免重叠
Edge-to-node gap2px线不穿入节点
Canvas padding50px边缘留白
Label gap below node4px标签与节点间距
Arrow marker size8px箭头大小

7.6 Responsive Sizing

Group SizeRecommended LayoutCanvas Size
≤ 8Circular400 × 400
9-20Force-directed 或 Circular600 × 600
21-40Force-directed800 × 800
41+Force-directed + group clustering1000 × 1000+

8. DSL Grammar (Sociogram)

document        = header config* group_def* node_def* edge_def*
header          = "sociogram" quoted_string? NEWLINE

config          = "config:" config_key "=" config_value NEWLINE
config_key      = "layout" | "sizing" | "highlight" | "coloring"
config_value    = /[a-zA-Z0-9_, -]+/

group_def       = "group" ID properties? NEWLINE
                  INDENT node_ref+ DEDENT

node_def        = ID properties? NEWLINE
properties      = "[" property ("," property)* "]"
property        = "label:" quoted_string
               | "group:" ID
               | "size:" SIZE
               | "role:" ROLE
               | kv_prop

SIZE            = "small" | "medium" | "large"
ROLE            = "star" | "isolate" | "bridge"

edge_def        = ID edge_op ID edge_props? NEWLINE
edge_op         = "->" | "<->" | "--"          (* positive *)
               | "-x>" | "<x->" | "-x-"       (* negative/rejection *)
               | "-.>" | "<.->" | "-.-"        (* neutral *)
               | "==>" | "<==>" | "==="        (* strong positive *)
               | "===>" | "<===>"              (* very strong positive *)
edge_props      = "[" edge_prop ("," edge_prop)* "]"
edge_prop       = "label:" quoted_string
               | "weight:" NUMBER

ID              = /[a-zA-Z][a-zA-Z0-9_-]*/
quoted_string   = '"' /[^"]*/ '"'
NUMBER          = /[0-9]+/
kv_prop         = IDENTIFIER ":" VALUE

9. Test Cases

Case 1: Basic Classroom Sociogram (Directed Choices)

sociogram "Mrs. Chen's 4th Grade Class"
  alice [label: "Alice"]
  bob [label: "Bob"]
  carol [label: "Carol"]
  dave [label: "Dave"]
  eve [label: "Eve"]
  frank [label: "Frank"]
  alice -> bob
  alice -> carol
  bob -> alice
  bob -> dave
  carol -> alice
  carol -> eve
  dave -> bob
  dave -> frank
  eve -> carol
  eve -> alice
  frank -> dave

验证:alice 是 star(in-degree 3),frank 是 neglectee(in-degree 1, 仅被 dave 选)。alice ↔ bob 和 alice ↔ carol 是 mutual pairs。

Case 2: With Groups and Rejection (Bullying Analysis)

sociogram "Playground Dynamics"
  config: layout = force-directed
  config: highlight = stars, isolates, cliques
  config: coloring = group

  group boys [label: "Boys", color: "#42A5F5"]
    tom
    jack
    mike
    leo

  group girls [label: "Girls", color: "#EF5350"]
    anna
    beth
    chloe
    diana

  tom <-> jack
  tom -> mike
  jack -> leo
  mike -x> leo [label: "conflict"]
  anna <-> beth
  anna <-> chloe
  beth <-> chloe
  anna -> diana
  diana -.- tom
  leo -.- anna

验证:anna-beth-chloe 形成 clique(三人互选)。leo 接近 isolate(仅 jack 单向选择)。mike → leo 是 rejection(红色虚线)。diana 和 tom 之间是 neutral。

Case 3: Organizational Influence Map

sociogram "Engineering Team Informal Influence"
  config: layout = concentric
  config: sizing = in-degree

  ceo [label: "CEO", group: leadership]
  vp [label: "VP Eng", group: leadership]
  lead1 [label: "Tech Lead A", group: team-a]
  lead2 [label: "Tech Lead B", group: team-b]
  dev1 [label: "Senior Dev", group: team-a]
  dev2 [label: "Dev", group: team-a]
  dev3 [label: "Dev", group: team-b]
  dev4 [label: "Junior Dev", group: team-b]
  ops [label: "DevOps", group: infra]

  dev1 -> lead1
  dev2 -> lead1
  dev2 -> dev1
  dev3 -> lead2
  dev4 -> dev3
  lead1 -> vp
  lead2 -> vp
  vp -> ceo
  dev1 -> ops [label: "deployment help"]
  dev3 -> ops [label: "infra questions"]
  lead1 <-> lead2 [label: "weekly sync"]
  dev4 -> dev1 [label: "mentorship"]

验证:concentric 布局中 lead1 和 vp 应在内圈(高 in-degree),dev4 在外圈。ops 是 bridge(连接 team-a 和 team-b)。

Case 4: Group Therapy Sociogram (Social Atom)

sociogram "Group Therapy Session 5 - Trust Network"
  config: layout = circular

  therapist [label: "Dr. Park", role: star]
  james [label: "James"]
  maria [label: "Maria"]
  lee [label: "Lee"]
  sarah [label: "Sarah"]
  tom [label: "Tom"]
  nina [label: "Nina"]

  james -> therapist
  james <-> maria [weight: 3, label: "strong bond"]
  james -> lee
  maria -> therapist
  maria -> sarah
  lee -> therapist
  lee -.- nina
  sarah <-> nina
  sarah -> therapist
  tom -> therapist
  nina -> maria

验证:circular 布局,therapist 是 star。james ↔ maria 是 strong mutual pair(粗线)。tom 接近 isolate(只连接了 therapist)。lee 和 nina 之间是 neutral。

Case 5: Criminal Network Analysis

sociogram "Operation Sunset - Communication Network"
  config: layout = force-directed
  config: sizing = betweenness

  boss [label: "Subject Alpha"]
  lt1 [label: "Lieutenant 1"]
  lt2 [label: "Lieutenant 2"]
  courier1 [label: "Courier A"]
  courier2 [label: "Courier B"]
  contact1 [label: "External Contact 1"]
  contact2 [label: "External Contact 2"]
  associate1 [label: "Associate"]
  associate2 [label: "Associate"]

  boss <-> lt1 [weight: 4]
  boss <-> lt2 [weight: 4]
  lt1 -> courier1
  lt1 -> courier2
  lt2 -> associate1
  lt2 -> associate2
  courier1 -> contact1 [label: "supplier"]
  courier2 -> contact2 [label: "distributor"]
  lt1 <-> lt2 [weight: 2]
  associate1 -.- courier1

验证:boss 和 lt1 的 betweenness 最高(节点最大)。courier1 是 bridge(连接 lt1 和 contact1)。层级结构应在 force-directed 中自然呈现。

Case 6: Large Group Stress Test (30 nodes)

sociogram "Conference Networking"
  config: layout = force-directed

  p1 [label: "Person 1", group: a]
  p2 [label: "Person 2", group: a]
  p3 [label: "Person 3", group: a]
  p4 [label: "Person 4", group: a]
  p5 [label: "Person 5", group: a]
  p6 [label: "Person 6", group: b]
  p7 [label: "Person 7", group: b]
  p8 [label: "Person 8", group: b]
  p9 [label: "Person 9", group: b]
  p10 [label: "Person 10", group: b]
  p11 [label: "Person 11", group: c]
  p12 [label: "Person 12", group: c]
  p13 [label: "Person 13", group: c]
  p14 [label: "Person 14", group: c]
  p15 [label: "Person 15", group: c]
  p16 [label: "Person 16", group: d]
  p17 [label: "Person 17", group: d]
  p18 [label: "Person 18", group: d]
  p19 [label: "Person 19", group: d]
  p20 [label: "Person 20", group: d]
  p21 [label: "Person 21"]
  p22 [label: "Person 22"]
  p23 [label: "Person 23"]
  p24 [label: "Person 24"]
  p25 [label: "Person 25"]
  p26 [label: "Person 26"]
  p27 [label: "Person 27"]
  p28 [label: "Person 28"]
  p29 [label: "Person 29"]
  p30 [label: "Person 30"]
  p1 <-> p2
  p1 <-> p3
  p2 <-> p4
  p3 <-> p5
  p4 <-> p5
  p6 <-> p7
  p6 <-> p8
  p7 <-> p9
  p8 <-> p10
  p11 <-> p12
  p11 <-> p13
  p12 <-> p14
  p13 <-> p15
  p16 <-> p17
  p16 <-> p18
  p17 <-> p19
  p18 <-> p20
  p1 -> p6 [label: "cross-group"]
  p6 -> p11 [label: "cross-group"]
  p11 -> p16 [label: "cross-group"]
  p21 -> p1
  p22 -> p6
  p23 -> p11
  p24 -> p16
  p25 -- p26
  p27 -- p28
  p29 -- p30

验证:30 节点 → 自动 800×800 canvas。4 个 group 应通过 force-directed 自然聚类。p1、p6、p11、p16 是 cross-group bridges。p25-p30 是独立 pairs。


10. SVG Implementation Details

10.1 Arrow Markers

<defs>
  <!-- Positive arrow (dark gray) -->
  <marker id="sociogram-arrow" viewBox="0 0 10 10" refX="9" refY="5"
          markerWidth="8" markerHeight="8" orient="auto">
    <path d="M 0 0 L 10 5 L 0 10 z" fill="#333"/>
  </marker>
  <!-- Rejection arrow (red) -->
  <marker id="sociogram-arrow-reject" viewBox="0 0 10 10" refX="9" refY="5"
          markerWidth="8" markerHeight="8" orient="auto">
    <path d="M 0 0 L 10 5 L 0 10 z" fill="#D32F2F"/>
  </marker>
  <!-- Neutral arrow (gray) -->
  <marker id="sociogram-arrow-neutral" viewBox="0 0 10 10" refX="9" refY="5"
          markerWidth="8" markerHeight="8" orient="auto">
    <path d="M 0 0 L 10 5 L 0 10 z" fill="#9E9E9E"/>
  </marker>
</defs>

10.2 Edge Rendering

Edge-to-edge calculation (同 ecomap):

  • 线从节点边缘到节点边缘,不是中心到中心
  • 计算方式:(center_A, center_B) 连线上,减去各自 radius + marker size

Bidirectional edges:

  • Mutual choice (<->):两端都有 marker,用单条线
  • 避免重叠:如果 A→B 和 B→A 都是单向但不是 mutual,画两条略微弯曲的线(offset ±3px)

Self-referential edges:

  • 不支持(sociogram 不需要自指关系)

10.3 Clique Highlighting

config: highlight = cliques 时:

  1. 检测所有 cliques(完全子图,≥3 nodes)
  2. 对每个 clique,计算 convex hull
  3. 渲染半透明背景 <polygon> + 圆角处理
<polygon points="..." fill="#42A5F5" fill-opacity="0.08"
         stroke="#42A5F5" stroke-opacity="0.2" stroke-width="1"
         class="schematex-sociogram-clique"/>

10.4 CSS Classes

.schematex-sociogram-node { }
.schematex-sociogram-node-star { }
.schematex-sociogram-node-isolate { }
.schematex-sociogram-edge { }
.schematex-sociogram-edge-positive { }
.schematex-sociogram-edge-negative { }
.schematex-sociogram-edge-neutral { }
.schematex-sociogram-label { }
.schematex-sociogram-clique { }
.schematex-sociogram-group-label { }

11. Sociogram Variants (Future Phases)

11.1 Social Atom (Moreno)

个人版 sociogram,一个人画出自己周围最重要的关系。可复用 ecomap radial layout。

11.2 Spectrogram

线性排列,成员在一条线上按某个维度排位。布局极简(一维)。

11.3 Target Sociogram

靶心布局——焦点人物在中心,关系越近的人越靠近靶心。类似 concentric layout 但以单人为中心。


12. Implementation Priority

PriorityFeatureComplexity复用
P0 (Phase 3)Circular layout + directed edges + 3 valence typesMediumArrow markers 复用 ecomap
P0Node auto-detection (star/isolate)Low纯数据计算
P1Force-directed layout (Fruchterman-Reingold)High新算法,但公式明确
P1Group coloring + group-based node clusteringMediumColor palette 复用 ecomap
P1Edge weight → line thicknessLow
P2Concentric layoutMedium基于 radial 改造
P2Clique detection + convex hull highlightingHigh图论算法
P2Node sizing by metric (in-degree/betweenness)Medium
P3Edge labelsLow复用 ecomap
P3Social Atom variant (egocentric view)Low复用 ecomap radial
P3Bridge detectionMediumBetweenness centrality