---
code: "NET-11"
id: "c-galaxy"
tab: "network"
kind: "core"
title: "Galaxy Force · 다중 중심"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "relationship"
dataShape: "flows, ties or connected entities"
tasks: ["show connections", "show hierarchy", "trace flow"]
tags: ["network", "relationship", "flow", "galaxy", "force", "다중", "중심"]
gallery: "https://graph.heal7.com/#NET-11"
js: "/sku/NET-11.js"
---

# [NET-11] Galaxy Force · 다중 중심

> AI 붙여넣기 카드. 갤러리 런타임(`main.js`)이 아니라 이 파일을 가져와라.

## 언제 가져가나
3개 그룹이 각자의 중심을 형성하며 떠다니는 force — 군집 분리가 자연스럽게.

**응용** 사용자 페르소나 클러스터, 학파/진영 구분, 추천 그룹.

## 데이터 모양
- family: `relationship`
- dataShape: flows, ties or connected entities
- tasks: show connections, show hierarchy, trace flow
- tags: network, relationship, flow, galaxy, force, 다중, 중심


## 의존
echarts@5 · load `low` · library `ECharts`

## 붙여넣는 법
1. echarts 5.x 로드 (GL이면 echarts-gl도)
2. 컨테이너 id를 원본 id와 맞추거나 `document.getElementById` 한 줄만 바꾼다
3. `T`, `reg`, `cssv` 가 필요하면 갤러리 테마 스텁을 함께 가져간다

```js
const T = {
  "bg": "transparent",
  "fg": "#ece8f5",
  "sub": "#a59bbd",
  "grid": "rgba(255,255,255,.08)",
  "gold": "#e8c069",
  "royal": "#6b8cff",
  "rose": "#e07a9f",
  "teal": "#6dd2c4",
  "plum": "#b487e8"
};
const cssv = (n, fb) => (getComputedStyle(document.documentElement).getPropertyValue(n).trim() || fb);
const isDark = () => document.documentElement.getAttribute('data-theme') !== 'light';
const charts = [];
const reg = (id, opt) => {
  const dom = document.getElementById(id); if (!dom) return;
  const c = echarts.init(dom, null, {renderer:'canvas'});
  c.setOption(opt);
  charts.push(c);
  return c;
};
const factory = function(){
  const nodes=[], links=[];
  const groups = [
    {name:'알파', color:T.gold, n:8},
    {name:'베타', color:T.royal, n:7},
    {name:'감마', color:T.rose, n:6}
  ];
  groups.forEach((g,gi)=>{
    for(let i=0;i<g.n;i++) nodes.push({name:`${g.name}-${i+1}`, category:gi, symbolSize: 10+Math.random()*14});
    // intra-group links
    for(let i=0;i<g.n;i++) for(let j=i+1;j<g.n;j++) if(Math.random()<.45)
      links.push({source:`${g.name}-${i+1}`, target:`${g.name}-${j+1}`});
  });
  // few cross-links
  links.push({source:'알파-1', target:'베타-2'},{source:'베타-3', target:'감마-1'},{source:'감마-2', target:'알파-4'});
  reg('c-galaxy',{
    backgroundColor:T.bg, tooltip:{},
    legend:{data:groups.map(g=>g.name), bottom:0, textStyle:{color:T.sub}},
    series:[{
      type:'graph', layout:'force', roam:true, draggable:true,
      categories: groups.map(g=>({name:g.name, itemStyle:{color:g.color}})),
      data: nodes, links,
      force:{repulsion:90, edgeLength:[30,80], gravity:0.18},
      lineStyle:{color:'source', opacity:.4, width:1},
      emphasis:{focus:'adjacency', lineStyle:{width:2}}
    }]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 2978-3005
- gallery: https://graph.heal7.com/#NET-11
- raw js: https://graph.heal7.com/sku/NET-11.js

```js
function(){
  const nodes=[], links=[];
  const groups = [
    {name:'알파', color:T.gold, n:8},
    {name:'베타', color:T.royal, n:7},
    {name:'감마', color:T.rose, n:6}
  ];
  groups.forEach((g,gi)=>{
    for(let i=0;i<g.n;i++) nodes.push({name:`${g.name}-${i+1}`, category:gi, symbolSize: 10+Math.random()*14});
    // intra-group links
    for(let i=0;i<g.n;i++) for(let j=i+1;j<g.n;j++) if(Math.random()<.45)
      links.push({source:`${g.name}-${i+1}`, target:`${g.name}-${j+1}`});
  });
  // few cross-links
  links.push({source:'알파-1', target:'베타-2'},{source:'베타-3', target:'감마-1'},{source:'감마-2', target:'알파-4'});
  reg('c-galaxy',{
    backgroundColor:T.bg, tooltip:{},
    legend:{data:groups.map(g=>g.name), bottom:0, textStyle:{color:T.sub}},
    series:[{
      type:'graph', layout:'force', roam:true, draggable:true,
      categories: groups.map(g=>({name:g.name, itemStyle:{color:g.color}})),
      data: nodes, links,
      force:{repulsion:90, edgeLength:[30,80], gravity:0.18},
      lineStyle:{color:'source', opacity:.4, width:1},
      emphasis:{focus:'adjacency', lineStyle:{width:2}}
    }]
  });
}
```

