input: Write a python function to find the minimum cost to travel between nodes given a list of costs.
  assert min_cost(3, [(0, 1, 1), (1, 2, 1), (0, 2, 3)]) == 1
  assert min_cost(4, [(0, 1, 10), (1, 2, 20), (2, 3, 30), (0, 3, 15)]) == 10
  assert min_cost(3, [(0, 1, 2), (1, 2, 3), (0, 2, 1)]) == 1
output: def min_cost(n, costs):
      import heapq
      
      graph = {i: [] for i in range(n)}
      for u, v, cost in costs:
          graph[u].append((cost, v))
          graph[v].append((cost, u))
      
      min_heap = [(0, 0)]  # (cost, node)
      visited = set()
      total_cost = 0
      
      while min_heap:
          cost, u = heapq.heappop(min_heap)
          if u in visited:
              continue
          visited.add(u)
          total_cost += cost
          
          for next_cost, v in graph[u]:
              if v not in visited:
                  heapq.heappush(min_heap, (next_cost, v))
      
      return total_cost