๐Ÿ“ฆ๊ทธ๋ž˜ํ”„์˜ ํŠน์ • ํ•˜์œ„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ถ”์ถœํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜, K-Core

๐Ÿ“ฆ๊ทธ๋ž˜ํ”„์˜ ํŠน์ • ํ•˜์œ„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ถ”์ถœํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜, K-Core
Photo by Alina Grubnyak / Unsplash

Definition

  • K-Core ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ๊ทธ๋ž˜ํ”„ ์ด๋ก ์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ, ๊ทธ๋ž˜ํ”„์˜ ํŠน์ • ๋ถ€๋ถ„์„ ์ถ”์ถœํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • K-Core๋Š” ๊ฐ ๋…ธ๋“œ๊ฐ€ ์ตœ์†Œํ•œ K๊ฐœ์˜ ์ด์›ƒ ๋…ธ๋“œ๋ฅผ ๊ฐ€์ง€๋Š” ์ตœ๋Œ€ ๋ถ€๋ถ„ ๊ทธ๋ž˜ํ”„๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

Motivation

  • ์†Œ์…œ ๋„คํŠธ์›Œํฌ, ์ƒ๋ฌผํ•™์  ๋„คํŠธ์›Œํฌ, ์ธํ„ฐ๋„ท ๊ตฌ์กฐ ๋“ฑ ๋‹ค์–‘ํ•œ ๋ถ„์•ผ์—์„œ ๋ฐ€์ง‘๋œ ํ•˜์œ„ ๊ตฌ์กฐ๋ฅผ ์‹๋ณ„ํ•˜๊ธฐ ์œ„ํ•ด ๋“ฑ์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฐœ์ธ์ ์ธ ๊ฒฝํ—˜์—์„œ๋Š” FDS ๊ด€๋ จ ์‚ฌ๊ธฐ๊ฑฐ๋ž˜๋ฅผ ์ง‘๋‹จ์œผ๋กœ ํ•˜๋Š” ์—…์ฒด๋ฅผ ํƒ์ง€ํ•˜๊ธฐ ์œ„ํ•ด์„œ ํ™œ์šฉํ•œ ๋ฐ” ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ด๋Š” ๋„คํŠธ์›Œํฌ์˜ ์ฃผ์š” ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๋ถ„์„ํ•˜๊ณ , ์ค‘์š”ํ•œ ๋…ธ๋“œ๋“ค์„ ์‹๋ณ„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

Pros & Cons

Pros

  1. ๋ฐ€์ง‘๋œ ํ•˜์œ„ ๊ตฌ์กฐ ์‹๋ณ„: ๊ทธ๋ž˜ํ”„ ๋‚ด์—์„œ ๋ฐ€์ง‘๋œ ํ•˜์œ„ ๊ตฌ์กฐ๋ฅผ ํšจ์œจ์ ์œผ๋กœ ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ์ค‘์š” ๋…ธ๋“œ ์‹๋ณ„: ๋„คํŠธ์›Œํฌ ๋‚ด์—์„œ ์ค‘์š”ํ•œ ๋…ธ๋“œ๋ฅผ ์‹๋ณ„ํ•˜๋Š” ๋ฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.
  3. ๋‹ค์–‘ํ•œ ์‘์šฉ ๋ถ„์•ผ: ์†Œ์…œ ๋„คํŠธ์›Œํฌ, ์ƒ๋ฌผํ•™์  ๋„คํŠธ์›Œํฌ, ์ธํ„ฐ๋„ท ๊ตฌ์กฐ ๋“ฑ ๋‹ค์–‘ํ•œ ๋ถ„์•ผ์— ์ ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

Cons

  1. ๋ณต์žก์„ฑ: ํฐ ๊ทธ๋ž˜ํ”„์— ๋Œ€ํ•ด K-Core๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ๊ฒƒ์€ ๋ณต์žกํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ: ํฐ ๊ทธ๋ž˜ํ”„๋ฅผ ์ฒ˜๋ฆฌํ•  ๋•Œ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์ด ๋งŽ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ์ •ํ™•๋„ ๋ฌธ์ œ: ๋ฐ€์ง‘๋œ ํ•˜์œ„ ๊ตฌ์กฐ๋ฅผ ์‹๋ณ„ํ•˜๋Š” ๊ณผ์ •์—์„œ ์ผ๋ถ€ ์ค‘์š”ํ•œ ๋…ธ๋“œ๊ฐ€ ๋ˆ„๋ฝ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Alternatiive

  1. Clique: ๊ทธ๋ž˜ํ”„ ๋‚ด์—์„œ ๋ชจ๋“  ๋…ธ๋“œ๊ฐ€ ์„œ๋กœ ์—ฐ๊ฒฐ๋œ ๋ถ€๋ถ„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ฐพ๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜.
  2. Community Detection: ๋„คํŠธ์›Œํฌ ๋‚ด์—์„œ ์ปค๋ฎค๋‹ˆํ‹ฐ๋ฅผ ๋ฐœ๊ฒฌํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜.
  3. Modularity Optimization: ๋„คํŠธ์›Œํฌ์˜ ๋ชจ๋“ˆ์„ฑ์„ ์ตœ์ ํ™”ํ•˜์—ฌ ์ปค๋ฎค๋‹ˆํ‹ฐ๋ฅผ ์ฐพ๋Š” ๋ฐฉ๋ฒ•

Sample

import networkx as nx
import matplotlib.pyplot as plt
from networkx.algorithms.clique import find_cliques
from networkx.algorithms.community import greedy_modularity_communities

def compute_and_visualize_k_core(edges, k):
    # ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ
    G = nx.Graph()
    G.add_edges_from(edges)
    
    # K-Core ๊ณ„์‚ฐ
    k_core = nx.k_core(G, k=k)
    
    # ๊ทธ๋ž˜ํ”„ ์‹œ๊ฐํ™”
    pos = nx.spring_layout(G)
    plt.figure(figsize=(8, 6))
    nx.draw(G, pos, with_labels=True, node_color='lightblue', edge_color='gray')
    nx.draw(k_core, pos, with_labels=True, node_color='red', edge_color='black')
    plt.title(f"K-Core (k={k}) of the Graph")
    plt.show()
    
    return k_core.nodes(), k_core.edges()

def find_and_visualize_cliques(edges):
    # ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ
    G = nx.Graph()
    G.add_edges_from(edges)
    
    # Clique ๊ณ„์‚ฐ
    cliques = list(find_cliques(G))
    
    # ๊ทธ๋ž˜ํ”„ ์‹œ๊ฐํ™”
    pos = nx.spring_layout(G)
    plt.figure(figsize=(8, 6))
    nx.draw(G, pos, with_labels=True, node_color='lightblue', edge_color='gray')
    for clique in cliques:
        nx.draw_networkx_nodes(G, pos, nodelist=clique, node_color='red')
    plt.title("Cliques in the Graph")
    plt.show()
    
    return cliques

def detect_and_visualize_communities(edges):
    # ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ
    G = nx.Graph()
    G.add_edges_from(edges)
    
    # ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฐ์ง€
    communities = list(greedy_modularity_communities(G))
    
    # ๊ทธ๋ž˜ํ”„ ์‹œ๊ฐํ™”
    pos = nx.spring_layout(G)
    plt.figure(figsize=(8, 6))
    nx.draw(G, pos, with_labels=True, node_color='lightblue', edge_color='gray')
    colors = ['red', 'blue', 'green', 'orange', 'purple']
    for i, community in enumerate(communities):
        nx.draw_networkx_nodes(G, pos, nodelist=list(community), node_color=colors[i % len(colors)])
    plt.title("Communities in the Graph")
    plt.show()
    
    return communities

# ์˜ˆ์‹œ ๋ฐ์ดํ„ฐ
edges = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3), (3, 4)]

# K-Core ๊ฒฐ๊ณผ
k = 2
nodes, edges = compute_and_visualize_k_core(edges, k)
print("Nodes in k-core:", nodes)
print("Edges in k-core:", edges)

# Clique ๊ฒฐ๊ณผ
cliques = find_and_visualize_cliques(edges)
print("Cliques in the graph:", cliques)

# Community Detection ๊ฒฐ๊ณผ
communities = detect_and_visualize_communities(edges)
print("Communities in the graph:", communities)


Read more

๋‚ด๊ฐ€ ๋†“์น˜๊ณ  ์žˆ๋˜ ๋ฏธ๋ž˜, ๋จผ์ € ์˜จ ๋ฏธ๋ž˜๋ฅผ ์ฝ๊ณ 

๋‚ด๊ฐ€ ๋†“์น˜๊ณ  ์žˆ๋˜ ๋ฏธ๋ž˜, ๋จผ์ € ์˜จ ๋ฏธ๋ž˜๋ฅผ ์ฝ๊ณ 

์žฅ๊ฐ•๋ช… ์ž‘๊ฐ€์˜ ์ฑ…์€, ์œ ํ•™์‹œ์ ˆ ์ฝ๊ณ  ์ฒ˜์Œ์ด์—ˆ๋‹ค. ์œ ํ•™์‹œ์ ˆ "ํ•œ๊ตญ์ด ์‹ซ์–ด์„œ"๋ผ๋Š” ์ฑ…์€ ๋™๊ธฐ๋ถ€์—ฌ๊ฐ€ ์ƒ๋‹นํžˆ ๋˜๋Š” ์ฑ…์ด์—ˆ๋‹ค. ํ•œ๊ตญ์„ ๋– ๋‚˜ ์ƒˆ๋กœ์šด ์ •์ฑ„์„ฑ์„ ํ•™์ƒ์œผ๋กœ์„œ Build up ํ•ด๋‚˜๊ฐ€๊ณ  ์žˆ๋˜ ์ƒํ™ฉ์—์„œ ์ด ์ฑ…์€ ์ œ๋ชฉ๋ถ€ํ„ฐ ๊ฝค ์†”๊นƒํ•˜์˜€๋‹ค. ๋ฌผ๋ก  ๊ฒฐ๋ง์ด ๊ธฐ์–ต๋‚  ์ •๋„๋กœ ์ธ์ƒ๊นŠ์€ ์ฑ…์€ ์•„๋‹ˆ์—ˆ์ง€๋งŒ ๋ง์ด๋‹ค. ๊ทธ๋ ‡๊ฒŒ ์‹œ๊ฐ„์ด ํ˜๋Ÿฌ ์žฅ๊ฐ•๋ช… ์ž‘๊ฐ€์˜ ์ฑ…์€ ๋” ์ด์ƒ ์ฝ์ง€ ์•Š๋˜

By Bongho, Lee
immich Docker Log

immich Docker Log

.env & docker-compose Download wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env Modification Log * .env์—์„œ UPLOAD_LOCATION๋ฅผ ์ˆ˜์ • * NFS๋กœ ์ฒ˜์Œ์— ์ง„ํ–‰ํ•˜์˜€์œผ๋‚˜ SMB๋กœ ์ˆ˜์ • NFS Issue * UID/GID ๋ถˆ์ผ์น˜ ๋ฌธ์ œ์ด์Šˆ ๋ฐœ์ƒ * ์„œ๋ฒ„์™€

By Bongho, Lee
๊ณ ๊ฐ ๊ฒฝํ—˜์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ?

๊ณ ๊ฐ ๊ฒฝํ—˜์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ?

๊ณ ๊ฐ๊ฒฝํ—˜์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ? 1. ๊ณผ๊ฑฐ ์–ด๋А ๋Œ€ํ˜• ํ”„๋กœ์ ํŠธ์—์„œ ์žˆ๋˜ ์ผ์ด๋‹ค. ์‹ ์‚ฌ์—…์„ ์œ„ํ•ด์„œ ์˜ˆ์ธก ๋ชจ๋ธ ๊ฐ’์„ ์ œ๊ณตํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด์—ˆ๋‹ค. ๋ฐ์ดํ„ฐ๋„ ์—†๊ณ ,์–ด๋А์ •๋„์˜ ์ •ํ™•๋„๋ฅผ ์ œ๊ณตํ•ด์•ผ ํ•˜๋Š”์ง€ ๋‹ต์ด ์—†์—ˆ๋‹ค. ์ ์ถ”์ •์„ ํ•  ๊ฒƒ์ธ๊ฐ€? ๊ตฌ๊ฐ„ ์ถ”์ •์„ ํ•  ๊ฒƒ์ธ๊ฐ€๋ฅผ ๊ฐ€์ง€๊ณ  ๋…ผ์˜์ค‘์ด์—ˆ๋‹ค. Product Manager ์ค„๊ธฐ์ฐจ๊ฒŒ ๊ณ ๊ฐ๊ฒฝํ—˜์„ ๋‚ด์„ธ์šฐ๋ฉฐ ์ ์ถ”์ •์œผ๋กœ ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ์ฃผ์žฅํ•˜์˜€๋‹ค. ๊ทผ๊ฑฐ๋Š” ์˜ค๋กฏ์ด "๊ณ ๊ฐ ๊ฒฝํ—˜"์ด์—ˆ๋‹ค.

By Bongho, Lee
์ˆ˜์š”์˜ˆ์ธก, ์ˆ˜์ •๊ตฌ์Šฌ์ด ์•„๋‹Œ ๋ชฉํ‘œ๋ฅผ ํ–ฅํ•œ ๋ƒ‰์ •ํ•œ ๋‚˜์นจ๋ฐ˜

์ˆ˜์š”์˜ˆ์ธก, ์ˆ˜์ •๊ตฌ์Šฌ์ด ์•„๋‹Œ ๋ชฉํ‘œ๋ฅผ ํ–ฅํ•œ ๋ƒ‰์ •ํ•œ ๋‚˜์นจ๋ฐ˜

์ˆ˜์š”์˜ˆ์ธก์˜ ์ •์˜์™€ ๋น„์ฆˆ๋‹ˆ์Šค์—์„œ์˜ ์ค‘์š”์„ฑ ๊ธฐ์—…์˜ ์„ฑ์žฅ๊ณผ ์šด์˜ ํšจ์œจํ™”๋ฅผ ์œ„ํ•ด **์ˆ˜์š”์˜ˆ์ธก(Demand Forecasting)**์€ ์„ ํƒ์ด ์•„๋‹Œ ํ•„์ˆ˜ ์š”์†Œ๋กœ ์ž๋ฆฌ ์žก์•˜๋‹ค. ๋งŽ์€ ๊ฒฝ์˜์ง„๋“ค์ด ์ˆ˜์š”์˜ˆ์ธก์„ ๋ฏธ๋ž˜ ํŒ๋งค๋Ÿ‰์„ ์ •ํ™•ํžˆ ๋งžํžˆ๋Š” '์˜ˆ์–ธ'์œผ๋กœ ๊ธฐ๋Œ€ํ•˜์ง€๋งŒ, ์ด๋Š” ์ˆ˜์š”์˜ˆ์ธก์˜ ๋ณธ์งˆ์„ ์˜คํ•ดํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์ˆ˜์š”์˜ˆ์ธก์˜ ์ง„์งœ ์˜๋ฏธ: ๋ฏธ๋ž˜๋ฅผ ์ ์น˜๋Š” ์ˆ˜์ •๊ตฌ์Šฌ์ด ์•„๋‹ˆ๋ผ, ์šฐ๋ฆฌ๊ฐ€ ๋„๋‹ฌํ•ด์•ผ ํ•  '๋ชฉํ‘œ'๋ฅผ

By Bongho, Lee