graph-structure-options.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <style>
  2. .diagram-grid {
  3. display: grid;
  4. grid-template-columns: repeat(3, minmax(0, 1fr));
  5. gap: 16px;
  6. margin-top: 20px;
  7. }
  8. .graph-card {
  9. border: 1px solid #dbe3ec;
  10. border-radius: 16px;
  11. background: #fff;
  12. overflow: hidden;
  13. cursor: pointer;
  14. transition: .18s ease;
  15. }
  16. .graph-card:hover {
  17. transform: translateY(-2px);
  18. box-shadow: 0 12px 30px rgba(15, 23, 42, .10);
  19. }
  20. .graph-card.selected {
  21. border-color: #2563eb;
  22. box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
  23. }
  24. .graph-head {
  25. padding: 15px 16px 10px;
  26. border-bottom: 1px solid #eef2f7;
  27. }
  28. .graph-head h3 { margin: 0 0 5px; }
  29. .graph-head p { margin: 0; color: #64748b; font-size: 13px; }
  30. .canvas { padding: 12px; background: #f8fafc; }
  31. .graph-body { padding: 13px 16px 16px; }
  32. .graph-body ul { margin: 8px 0 0; padding-left: 18px; color: #475569; font-size: 13px; }
  33. .recommend {
  34. display: inline-block;
  35. margin-left: 7px;
  36. padding: 2px 7px;
  37. border-radius: 999px;
  38. color: #1d4ed8;
  39. background: #dbeafe;
  40. font-size: 11px;
  41. vertical-align: 2px;
  42. }
  43. .legend {
  44. display: flex;
  45. flex-wrap: wrap;
  46. gap: 12px;
  47. margin-top: 16px;
  48. padding: 12px 14px;
  49. border-radius: 12px;
  50. background: #f8fafc;
  51. color: #475569;
  52. font-size: 12px;
  53. }
  54. .dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; margin-right: 5px; }
  55. @media (max-width: 1000px) {
  56. .diagram-grid { grid-template-columns: 1fr; }
  57. }
  58. </style>
  59. <h2>平台需求应该怎样组织成“一张图”?</h2>
  60. <p class="subtitle">以“对近现代历史人物感兴趣”为例。点击一个方案;重点比较树骨架、跨节点连线和最终需求的表达能力。</p>
  61. <div class="diagram-grid">
  62. <div class="graph-card" data-choice="a-tree-only" onclick="toggleSelect(this)">
  63. <div class="graph-head">
  64. <h3>A. 单一大树</h3>
  65. <p>所有对象都强行放进一棵层级树</p>
  66. </div>
  67. <div class="canvas">
  68. <svg viewBox="0 0 320 300" width="100%" role="img" aria-label="单一大树方案">
  69. <g stroke="#94a3b8" stroke-width="2" fill="none">
  70. <path d="M160 38 L160 72 M160 72 L66 108 M160 72 L160 108 M160 72 L254 108"/>
  71. <path d="M66 136 L45 174 M66 136 L100 174"/>
  72. <path d="M160 136 L145 174 M160 136 L190 174"/>
  73. <path d="M254 136 L235 174 M254 136 L282 174"/>
  74. <path d="M45 202 L45 238 M145 202 L145 238 M235 202 L235 238"/>
  75. </g>
  76. <g font-family="sans-serif" font-size="12" text-anchor="middle">
  77. <rect x="110" y="10" width="100" height="30" rx="9" fill="#1d4ed8"/><text x="160" y="30" fill="white">毛泽东历史兴趣</text>
  78. <rect x="23" y="108" width="86" height="30" rx="8" fill="#dbeafe"/><text x="66" y="128">具体人物</text>
  79. <rect x="117" y="108" width="86" height="30" rx="8" fill="#dcfce7"/><text x="160" y="128">人物事件</text>
  80. <rect x="211" y="108" width="86" height="30" rx="8" fill="#fae8ff"/><text x="254" y="128">人物情感</text>
  81. <rect x="10" y="174" width="70" height="28" rx="8" fill="white" stroke="#60a5fa"/><text x="45" y="193">毛泽东</text>
  82. <rect x="82" y="174" width="70" height="28" rx="8" fill="white" stroke="#60a5fa"/><text x="117" y="193">朱德</text>
  83. <rect x="110" y="174" width="70" height="28" rx="8" fill="white" stroke="#4ade80"/><text x="145" y="193">抗日战争</text>
  84. <rect x="182" y="174" width="70" height="28" rx="8" fill="white" stroke="#4ade80"/><text x="217" y="193">解放战争</text>
  85. <rect x="200" y="174" width="70" height="28" rx="8" fill="white" stroke="#d946ef"/><text x="235" y="193">家国情怀</text>
  86. <rect x="272" y="174" width="42" height="28" rx="8" fill="white" stroke="#d946ef"/><text x="293" y="193">乐观</text>
  87. <rect x="9" y="238" width="72" height="34" rx="8" fill="#fff7ed" stroke="#fb923c"/><text x="45" y="252">毛泽东的</text><text x="45" y="266">战争经历</text>
  88. <rect x="102" y="238" width="86" height="34" rx="8" fill="#fff7ed" stroke="#fb923c"/><text x="145" y="252">抗战诗词的</text><text x="145" y="266">历史背景</text>
  89. <rect x="196" y="238" width="78" height="34" rx="8" fill="#fff7ed" stroke="#fb923c"/><text x="235" y="252">毛泽东为何</text><text x="235" y="266">坚持写诗</text>
  90. </g>
  91. </svg>
  92. </div>
  93. <div class="graph-body">
  94. <strong>优点:</strong>层级清楚,统计方便。
  95. <ul>
  96. <li>一个事件只能被迫选一个父节点</li>
  97. <li>“毛泽东—抗日战争—诗词创作”之间的真实联系会丢失</li>
  98. </ul>
  99. </div>
  100. </div>
  101. <div class="graph-card" data-choice="b-free-graph" onclick="toggleSelect(this)">
  102. <div class="graph-head">
  103. <h3>B. 完全自由图</h3>
  104. <p>人物、事件、情感和需求全部自由连接</p>
  105. </div>
  106. <div class="canvas">
  107. <svg viewBox="0 0 320 300" width="100%" role="img" aria-label="完全自由图方案">
  108. <defs>
  109. <marker id="arrowB" markerWidth="7" markerHeight="7" refX="6" refY="3.5" orient="auto"><path d="M0,0 L7,3.5 L0,7 z" fill="#64748b"/></marker>
  110. </defs>
  111. <g stroke="#64748b" stroke-width="1.8" fill="none" marker-end="url(#arrowB)">
  112. <path d="M74 75 L148 74"/><path d="M171 90 L112 145"/><path d="M192 91 L241 142"/>
  113. <path d="M91 169 L57 222"/><path d="M128 172 L169 222"/><path d="M226 169 L182 223"/>
  114. <path d="M231 163 C286 174 289 230 244 245"/><path d="M68 58 C114 18 214 21 243 55"/>
  115. <path d="M83 75 C44 112 43 176 57 221"/>
  116. </g>
  117. <g font-family="sans-serif" font-size="12" text-anchor="middle">
  118. <circle cx="62" cy="68" r="35" fill="#dbeafe" stroke="#3b82f6"/><text x="62" y="72">毛泽东</text>
  119. <circle cx="177" cy="70" r="39" fill="#dcfce7" stroke="#22c55e"/><text x="177" y="67">抗日</text><text x="177" y="82">战争</text>
  120. <circle cx="255" cy="67" r="31" fill="#fae8ff" stroke="#d946ef"/><text x="255" y="71">家国</text>
  121. <circle cx="100" cy="160" r="35" fill="#fae8ff" stroke="#d946ef"/><text x="100" y="164">诗词创作</text>
  122. <circle cx="246" cy="158" r="37" fill="#dcfce7" stroke="#22c55e"/><text x="246" y="155">解放</text><text x="246" y="170">战争</text>
  123. <rect x="19" y="222" width="83" height="42" rx="10" fill="#fff7ed" stroke="#fb923c"/><text x="60" y="240">毛泽东的</text><text x="60" y="255">战争经历</text>
  124. <rect x="128" y="222" width="92" height="42" rx="10" fill="#fff7ed" stroke="#fb923c"/><text x="174" y="240">毛泽东为何</text><text x="174" y="255">坚持写诗</text>
  125. <rect x="230" y="230" width="77" height="36" rx="10" fill="#fff7ed" stroke="#fb923c"/><text x="268" y="245">解放战争与</text><text x="268" y="258">诗词主题</text>
  126. </g>
  127. </svg>
  128. </div>
  129. <div class="graph-body">
  130. <strong>优点:</strong>关系表达最自由。
  131. <ul>
  132. <li>缺少统一骨架,数百条需求容易变成“蜘蛛网”</li>
  133. <li>难以保证每条需求都有稳定归属和完整覆盖</li>
  134. </ul>
  135. </div>
  136. </div>
  137. <div class="graph-card" data-choice="c-tree-backed-graph" onclick="toggleSelect(this)">
  138. <div class="graph-head">
  139. <h3>C. 树骨架上的关系图 <span class="recommend">推荐</span></h3>
  140. <p>分类树负责归属;关系线负责交织;需求节点负责输出</p>
  141. </div>
  142. <div class="canvas">
  143. <svg viewBox="0 0 320 300" width="100%" role="img" aria-label="树骨架上的关系图方案">
  144. <defs>
  145. <marker id="arrowC" markerWidth="7" markerHeight="7" refX="6" refY="3.5" orient="auto"><path d="M0,0 L7,3.5 L0,7 z" fill="#ef4444"/></marker>
  146. </defs>
  147. <g stroke="#94a3b8" stroke-width="2" fill="none">
  148. <path d="M160 36 L160 66 M160 66 L58 101 M160 66 L160 101 M160 66 L262 101"/>
  149. <path d="M58 129 L40 166 M58 129 L91 166"/>
  150. <path d="M160 129 L144 166 M160 129 L193 166"/>
  151. <path d="M262 129 L241 166 M262 129 L291 166"/>
  152. </g>
  153. <g stroke="#ef4444" stroke-width="2" stroke-dasharray="5 4" fill="none" marker-end="url(#arrowC)">
  154. <path d="M92 180 C115 145 122 143 144 180"/>
  155. <path d="M167 180 C196 139 217 140 241 180"/>
  156. <path d="M91 192 C131 224 188 221 238 192"/>
  157. </g>
  158. <g stroke="#f59e0b" stroke-width="2.2" fill="none">
  159. <path d="M91 194 L91 237"/><path d="M145 194 L159 237"/><path d="M241 194 L211 237"/>
  160. </g>
  161. <g font-family="sans-serif" font-size="12" text-anchor="middle">
  162. <rect x="105" y="8" width="110" height="30" rx="9" fill="#1d4ed8"/><text x="160" y="28" fill="white">毛泽东历史主题</text>
  163. <rect x="17" y="101" width="82" height="30" rx="8" fill="#dbeafe"/><text x="58" y="121">人物分支</text>
  164. <rect x="119" y="101" width="82" height="30" rx="8" fill="#dcfce7"/><text x="160" y="121">事件分支</text>
  165. <rect x="221" y="101" width="82" height="30" rx="8" fill="#fae8ff"/><text x="262" y="121">表达分支</text>
  166. <rect x="9" y="166" width="62" height="28" rx="8" fill="white" stroke="#60a5fa"/><text x="40" y="185">毛泽东</text>
  167. <rect x="61" y="166" width="62" height="28" rx="8" fill="white" stroke="#60a5fa"/><text x="92" y="185">朱德</text>
  168. <rect x="112" y="166" width="66" height="28" rx="8" fill="white" stroke="#4ade80"/><text x="145" y="185">抗日战争</text>
  169. <rect x="180" y="166" width="66" height="28" rx="8" fill="white" stroke="#4ade80"/><text x="213" y="185">解放战争</text>
  170. <rect x="213" y="166" width="56" height="28" rx="8" fill="white" stroke="#d946ef"/><text x="241" y="185">写诗</text>
  171. <rect x="271" y="166" width="42" height="28" rx="8" fill="white" stroke="#d946ef"/><text x="292" y="185">家国</text>
  172. <rect x="43" y="237" width="96" height="44" rx="10" fill="#fff7ed" stroke="#f59e0b"/><text x="91" y="255">毛泽东的</text><text x="91" y="270">战争时期经历</text>
  173. <rect x="143" y="237" width="111" height="44" rx="10" fill="#fff7ed" stroke="#f59e0b"/><text x="198" y="255">毛泽东为何在战争中</text><text x="198" y="270">持续进行诗词创作</text>
  174. </g>
  175. </svg>
  176. </div>
  177. <div class="graph-body">
  178. <strong>核心:</strong>一个需求可以挂靠多个正式树节点,并连接人物、事件、表达和证据元素。
  179. <ul>
  180. <li>保留树的分层、覆盖与统计能力</li>
  181. <li>保留跨分支关系线,允许一条需求表达多个对象的组合</li>
  182. </ul>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="legend">
  187. <span><i class="dot" style="background:#60a5fa"></i>人物节点</span>
  188. <span><i class="dot" style="background:#4ade80"></i>事件节点</span>
  189. <span><i class="dot" style="background:#d946ef"></i>情感节点</span>
  190. <span><i class="dot" style="background:#f59e0b"></i>平台需求节点</span>
  191. <span style="color:#ef4444">- - 红色虚线:跨分支语义关系</span>
  192. <span style="color:#64748b">灰色实线:树内父子关系</span>
  193. </div>