<｜begin▁of▁sentence｜>### Instruction:
Suppose you have a list of weighted edges representing connections between entities, where each entity is represented by a string ID. These edges form an undirected network. How would you create a networkx graph while efficiently managing the memory usage by ensuring that all node IDs are stored as integers? The edges have weights indicating the strength of the connection. Each edge is a tuple with the format ('source_id', 'target_id', weight).
### Response:
import networkx as nx
from graspologic.pipeline import GraphBuilder

# Initialize the GraphBuilder for an undirected graph
graph_builder = GraphBuilder(directed=False)

# Add weighted edges to the graph
edges = [('A', 'B', 2.5), ('A', 'C', 3.0), ('B', 'C', 1.5), ('C', 'D', 2.0)]
for source, target, weight in edges:
    graph_builder.add_edge(source, target, weight=weight)

# Build the graph
graph, id_map, original_ids = graph_builder.build()

# Print the networkx graph
print(graph)
# Print the map of original node ids to integer ids
print(id_map)
# Print the list of original node ids
print(original_ids)
<|EOT|>
