<｜begin▁of▁sentence｜>### Instruction:
Given a '.dot' file named 'my_graph.dot' which contains graph data in DOT language format, how can you read and convert it into a NetworkX MultiGraph or MultiDiGraph? If you want a regular Graph instead of a MultiGraph, how would you modify the code?
### Response:
import networkx as nx

# Path can be either a string with the file path or a file object
path = 'my_graph.dot'

# Read the .dot file and return a MultiGraph or MultiDiGraph
G = nx.nx_pydot.read_dot(path)

# If you want a Graph instead of a MultiGraph
G = nx.Graph(nx.nx_pydot.read_dot(path))

# Print the edges of the graph
print(G.edges())
<|EOT|>
