Vertex AI의 최신 멀티모달 모델인 Gemini 1.5 모델을 사용해 보고 100만 개의 토큰 컨텍스트 윈도우로 빌드할 수 있는 항목을 확인해 보세요.Vertex AI의 최신 멀티모달 모델인 Gemini 1.5 모델을 사용해 보고 100만 개의 토큰 컨텍스트 윈도우로 빌드할 수 있는 항목을 확인해 보세요.
Write Python code to draw nodes and edges of a weighted directed graph.
Each edge should be color-coded according to its weight. Add example data
to the graph to illustrate how to use the code.
응답
```python
import networkx as nx
import matplotlib.pyplot as plt
# Create a weighted directed graph
G = nx.DiGraph()
G.add_weighted_edges_from([
('A', 'B', 0.6),
('A', 'C', 0.2),
('B', 'D', 0.1),
('C', 'D', 0.7),
])
# Color-code the edges according to their weight
edge_colors = [plt.cm.jet(weight) for weight in nx.get_edge_attributes(G, 'weight').values()]
# Draw the graph
nx.draw(G, with_labels=True, edge_color=edge_colors)
plt.show()
```