<｜begin▁of▁sentence｜>### Instruction:
Imagine you're a Market Research Analyst at a leading logistics company. Your latest project involves analyzing the efficiency of delivery paths in a complex network of distribution centers. The company's operation spans across multiple centers, and you've been provided with specific data reflecting the current route efficiencies and costs between these centers. The data set includes information about the weighted directed paths between centers: for instance, the route from Center 1 to Center 2 has a cost of 1.0, from Center 2 to Center 3 costs 2.0, from Center 3 to Center 4 is 1.5, and from Center 2 to Center 4 is 2.5. 

Your task is to delve into the network centered around Center 2, to evaluate and possibly optimize the network of routes within a certain cost radius. This detailed analysis will help the company better understand the direct and indirect influence Center 2 has over other centers within a specific cost boundary. How can you extract and analyze this focused subset of the distribution network, taking into account the costs associated with moving between each center as denoted by the weights of the paths? This exercise will not only showcase potential areas for cost-saving but also highlight efficient routes that currently define the logistics framework centered around Center 2.
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add edges
G.add_weighted_edges_from([(1, 2, 1.0), (2, 3, 2.0), (3, 4, 1.5), (2, 4, 2.5)])

# Compute the ego graph for node 2 with radius 1
ego_g = nx.ego_graph(G, 2, radius=1, distance='weight')

print('Nodes in the ego graph:', ego_g.nodes())
print('Edges in the ego graph:', ego_g.edges(data=True))
<|EOT|>
