<｜begin▁of▁sentence｜>### Instruction:
Given an igraph graph with the edge set [(0, 1), (1, 2), (2, 3), (3, 4)], how can you convert this graph to a NetworkX graph while preserving the original order of the vertices and edges using the '_igraph_index' vertex property?
### Response:
import igraph as ig
import networkx as nx

# Create an igraph graph
ig_g = ig.Graph(edges=[(0, 1), (1, 2), (2, 3), (3, 4)])

# Convert to NetworkX graph
nx_g = ig_g.to_networkx()

# Access the '_igraph_index' attribute
for node in nx_g.nodes(data=True):
    print(f'Node {node[0]} has _igraph_index: {node[1].get('_igraph_index')}')

# Use nodes and edges from NetworkX graph
print('Nodes:', nx_g.nodes())
print('Edges:', nx_g.edges())
<|EOT|>
