<｜begin▁of▁sentence｜>### Instruction:
Imagine we're working with a network infrastructure represented in a configuration graph, where nodes denote switching points and the edges reflect the connection pathways with associated bandwidth costs (which may be positive or negative, indicating relative performance overhead). Specifically, we have a routing map laid out with the following bandwidth costs between network switches: a connection from Switch 0 to Switch 1 costs 5 units, from Switch 1 to Switch 2 costs 3 units, from Switch 2 to Switch 3 has a -2 unit cost reflecting a potential optimization, and a pathway from Switch 3 back to Switch 0 incurs a 1 unit cost.

For efficient network maintenance and optimal data flow, we're tasked with implementing a diagnostic routine to compute the shortest transmission paths and their corresponding overheads starting from Switch 0 to all the others in the system. Given the nature of our weighted connections, which potentially include negative paths optimizing bandwidth, employing the Bellman-Ford algorithm will be essential for this evaluation. Could you draft a systems analysis using this algorithm, based on our network routing schematic, to determine the most efficient routes along with their bandwidth costs starting from Switch 0 to all destination switches within our network infrastructure?
### Response:
import networkx as nx

# Create a weighted digraph
G = nx.DiGraph()
G.add_weighted_edges_from([(0, 1, 5), (1, 2, 3), (2, 3, -2), (3, 0, 1)])

# Compute shortest paths and distances from node 0 using Bellman-Ford algorithm
pred, dist = nx.bellman_ford_predecessor_and_distance(G, 0)

# Print the predecessor and distance dictionaries
print('Predecessors:', pred)
print('Distances:', dist)
<|EOT|>
