Skip to content

06 최소 신장 트리 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

06 최소 신장 트리 #31

wants to merge 6 commits into from

Conversation

dpfls0922
Copy link
Member

@dpfls0922 dpfls0922 commented Mar 12, 2025

최소 신장 트리(MST) 구현

  • MST를 구하는 방법에는 크게 크루스칼 알고리즘프림 알고리즘이 있다.
  • 이번 구현에서는 프림 알고리즘을 사용했습니다.

🛫 상근이의 여행

  • bfs, dfs, 최소신장트리의 특징을 이용해서 세 가지 풀이 진행

🎄 최소 신장 트리 / 🪐 행성 연결

  • 최소의 비용으로 모든 정점을 잇는 간선의 조합
  • 프림 알고리즘 사용

🏙️ 도시 분할 계획

  • 처음엔 게리맨더링과 같은 문제라 생각해서 두 가지 그룹으로 나눌 수 있는 모든 경우의 수에서 최소 신장 트리를 구할 생각이었음
  • N과 M 범위를 보면 경우가 매우 크기 때문에 더욱 효율적인 방법을 모색해야 했음
  • 일단 최소 신장 트리를 만들고 그 중에서 최대의 비용을 지불하는 간선을 제거하도록 함

⚡️ 전기가 부족해

  • 0이라는 가상의 노드를 두어 0번 노드와 발전소를 연결함
  • 이때 가중치를 0으로 둠

@dpfls0922 dpfls0922 self-assigned this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant