<｜begin▁of▁sentence｜>### Instruction:
As a neuroscience researcher studying brain connectivity, I'm interested in analyzing a directed graph representing neural pathways. The graph has vertices representing different brain regions and weighted edges corresponding to the strength of connections between them. Using the igraph library, I want to calculate the two shortest paths from a specific brain region (vertex 0) to another region (vertex 4) based on the weights of the connections. The edge weights represent the efficiency or strength of communication between these brain regions, which is crucial for understanding communication patterns within the neural network.
### Response:
import igraph as ig

# Create a directed graph with weighted edges
g = ig.Graph(directed=True)
g.add_vertices(5)
g.add_edges([(0,1), (0,2), (1,3), (2,3), (3,4)])
g.es['weight'] = [1, 2, 1, 3, 1]

# Get 2 shortest paths from vertex 0 to vertex 4
k_shortest_paths = g.get_k_shortest_paths(0, 4, k=2, weights='weight', mode='out')

# Print the shortest paths (vertex IDs)
for path in k_shortest_paths:
    print('Path:', path)
<|EOT|>
