๐Ÿ“ฆ๊ทธ๋ž˜ํ”„์˜ ํŠน์ • ํ•˜์œ„ ๊ทธ๋ž˜ํ”„๋ฅผ ์ถ”์ถœํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜, 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

[์ฑ…]Reshuffle: Who wins when AI restacks the knowledge economy

[์ฑ…]Reshuffle: Who wins when AI restacks the knowledge economy

์›๋ž˜๋Š” Amazon์— ๊ฐ€์„œ Personal Knowledge Managment์— ๊ด€ํ•œ ์ฑ…์„ ์‚ฌ๋ ค๊ณ  ํ–ˆ๋‹ค. Sketch Your Mind๋ผ๋Š” ์ฑ…์ด์—ˆ๋Š”๋ฐ, ๊ทธ ๋•Œ ์ด ์ฑ… โ€œReshuffleโ€์„ ๋ฐœ๊ฒฌํ•˜์˜€๋‹ค. AI๊ฐ€ ์–ด๋–ป๊ฒŒ Knowledge Economy๋ฅผ ํ”๋“ค ๊ฒƒ๊ฐ€? ๋ผ๋Š” ๋ถ€์ œ๋ฅผ ํ›‘์–ด๋ณด๋ฉด์„œ ์ €์ž๊ฐ€ ์“ด ๋‹ค๋ฅธ ์ฑ…์„ ๋ณด๊ฒŒ ๋˜์—ˆ๋Š”๋ฐ ๊ฑฐ๊ธฐ์— ๋‚ด๊ฐ€ ์ข‹์•„ํ–ˆ๋˜ ์ฑ…์„์“ด ์ €์ž๋ผ๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํฌ๊ฒŒ ๊ณ ๋ฏผํ•˜์ง€ ์•Š๊ณ  ๊ตฌ๋งค๋ฅผ ํ•˜๊ณ 

By Bongho, Lee
[์ฑ…]์˜ฌ๋ผ์šด๋“œํˆฌ์ž, ๋ˆ„๊ตฐ๊ฐ€์˜ ํˆฌ์ž์ผ๊ธฐ

[์ฑ…]์˜ฌ๋ผ์šด๋“œํˆฌ์ž, ๋ˆ„๊ตฐ๊ฐ€์˜ ํˆฌ์ž์ผ๊ธฐ

โ€œ์˜ฌ๋ผ์šด๋“œ ํˆฌ์žโ€๋ผ๋Š” ์ œ๋ชฉ์„ ๋ณด์•˜์„ ๋•Œ๋Š”, โ€œ์˜ฌ๋ผ์šด๋“œ ํ”Œ๋ ˆ์ด์–ดโ€๊ฐ€ ์ƒ๊ฐ์ด ๋‚ฌ๋‹ค. โ€œ์˜ฌ๋ผ์šด๋“œโ€๋ผ๋Š” ํ‘œํ˜„์„ ์˜ค๋žœ๋งŒ์— ๋“ค์–ด๋ณธ ๊นŒ๋‹ญ์ด์—ˆ๋‹ค. ๊ทธ๋Ÿผ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ์ด ์ฑ…์„ ๊ณ ๋ฅธ ๊ฒƒ์€ ์ €์ž๊ฐ€ ๊ทธ๊ฐ„ ๋ณด์—ฌ์ค€ ์ปจํ…์ธ ์— ๋Œ€ํ•œ ์‹ ๋ขฐ๊ฐ€ ์žˆ๋˜ ๊นŒ๋‹ญ์ด์—ˆ๋‹ค. ์ปจํ…์ธ ๋ฅผ ๋‹ค์–‘ํ•˜๊ฒŒ ๋ณด๋Š” ํŽธ์ด์ง€๋งŒ ๊นŠ์ด๊ฐ€ ์•„์ฃผ ์žˆ์ง€๋Š” ์•Š์•˜๋‹ค. ์—ฌ๊ธฐ์„œ ๊นŠ์ด๋ผ ํ•จ์€ ๊ธฐ์กด ์ „๋ฌธ์ ์ธ ์ •๋Ÿ‰์  ๋ถ„์„์˜ ๋‚ด์šฉ์˜ ์ˆ˜์ค€์„ ๋งํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

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

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

์žฅ๊ฐ•๋ช… ์ž‘๊ฐ€์˜ ์ฑ…์€, ์œ ํ•™์‹œ์ ˆ ์ฝ๊ณ  ์ฒ˜์Œ์ด์—ˆ๋‹ค. ์œ ํ•™์‹œ์ ˆ "ํ•œ๊ตญ์ด ์‹ซ์–ด์„œ"๋ผ๋Š” ์ฑ…์€ ๋™๊ธฐ๋ถ€์—ฌ๊ฐ€ ์ƒ๋‹นํžˆ ๋˜๋Š” ์ฑ…์ด์—ˆ๋‹ค. ํ•œ๊ตญ์„ ๋– ๋‚˜ ์ƒˆ๋กœ์šด ์ •์ฑ„์„ฑ์„ ํ•™์ƒ์œผ๋กœ์„œ 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