<｜begin▁of▁sentence｜>### Instruction:
Given the edge set [("A", "B", 3), ("A", "C", 17), ("A", "D", 14), ("B", "A", 3), ("B", "C", 12), ("B", "D", 16), ("C", "A", 13), ("C", "B", 12), ("C", "D", 4), ("D", "A", 14), ("D", "B", 15), ("D", "C", 2)], representing a complete weighted graph, can you calculate the greedy approximation to the Traveling Salesman Problem (TSP) starting from node 'D'? What is the cycle and its total cost?
### Response:
import networkx as nx
from networkx.algorithms import approximation as approx

# Create a graph
G = nx.Graph()
G.add_weighted_edges_from([("A", "B", 3), ("A", "C", 17), ("A", "D", 14), ("B", "A", 3), ("B", "C", 12), ("B", "D", 16), ("C", "A", 13), ("C", "B", 12), ("C", "D", 4), ("D", "A", 14), ("D", "B", 15), ("D", "C", 2)])

# Compute the TSP cycle starting at 'D'
cycle = approx.greedy_tsp(G, source="D")
cost = sum(G[n][nbr]["weight"] for n, nbr in nx.utils.pairwise(cycle))

print('Cycle:', cycle)
print('Cost:', cost)
<|EOT|>
