Skip to content

Instantly share code, notes, and snippets.

@pragatibaheti
Last active March 13, 2020 01:53
Show Gist options
  • Save pragatibaheti/ff131057c9add4448205bab9da63d3d7 to your computer and use it in GitHub Desktop.
Save pragatibaheti/ff131057c9add4448205bab9da63d3d7 to your computer and use it in GitHub Desktop.
Building environment in RL
import numpy as np
import pylab as plt
import networkx as nx
# mapping denote the corresponding edges between nodes
points_list = [(0,1), (1,5), (5,6), (5,4), (1,2), (2,3), (2,7)]
goal = 3
G=nx.Graph()
G.add_edges_from(points_list)
pos = nx.spring_layout(G)
nx.draw_networkx_nodes(G,pos)
nx.draw_networkx_edges(G,pos)
nx.draw_networkx_labels(G,pos)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment