title: How to extract skimage skeleton information to NetworkX nodes and edges in python for further advanced analysis
body: <p>Currently, I use skimage in python to extract the skeleton of open space from some a binarized map as following pictures, </p>
  
  <p><a href="https://i.stack.imgur.com/UJPlf.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UJPlf.gif" alt="Original BW map image"></a><a href="https://i.stack.imgur.com/aCJ7T.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aCJ7T.gif" alt="Skeleton-ized open area"></a></p>
  
  <p>With following python codes:</p>
  
  <pre><code>from skimage.morphology import skeletonize
  from skimage import draw
  from skimage.io import imread, imshow
  from skimage.color import rgb2gray
  
  # load image from file
  img_fname=os.path.join('images','mall1_2F_schema.png') 
  image=imread(img_fname)
  
  # Change RGB color to gray 
  image=rgb2gray(image)
  
  # Change gray image to binary
  image=np.where(image&gt;np.mean(image),1.0,0.0)
  
  # perform skeletonization
  skeleton = skeletonize(image)
  </code></pre>
  
  <p>Now I would like to extract the end points and cross points from the skeleton as nodes for Networkx graph object while calculating the distance between the neighboring nodes as edges for Networkx Graph object. Currently, I have to manually get the point coordinates and input to NetworkX object initialization process, do we have any smarter way to do everything automatically?</p>
  
  <p>By the way, I found <a href="https://stackoverflow.com/users/1811651/yaron-kahanovitch">yaron kahanovitch</a>'s answer to <a href="https://stackoverflow.com/questions/27648195/how-to-find-the-length-of-a-path-curve-in-a-picture#">the question on stackoverflow</a> proposes similar approaches. However, no more realization suggestions was given, and I think NetworkX could be one approach.</p>
  
  <p>Any suggestions from you are greatly appreciated.</p>