title: Add vertex attributes to a weighted igraph Graph in python
body: <p>I am learning python-igraph, and having difficulty in handling a graph which is divided to components (which are unconnected between them). When I apply one of the clustering algorithms on this graph it doesn't seem to work properly, and so I need to apply the algorithms to each subgraph (component) separately. So in order to maintain the identification of the vertices, I would like to add a vertex attribute that give me the id number in the original graph. My graph is constructed from a <a href="http://igraph.org/python/doc/igraph.GraphBase-class.html#Weighted_Adjacency" rel="nofollow">weighted adjacency</a> matrix:</p>
  
  <pre><code>import numpy as np
  import igraph
  
  def symmetrize(a):
      return a + a.T - 2*np.diag(a.diagonal())
  
  A = symmetrize(np.random.random((100,100)))
  
  G = igraph.Graph.Adjacency(A.tolist(),attr="weight",mode="UPPER")
  </code></pre>
  
  <p>I see that there should be a way to add <a href="http://igraph.org/python/doc/igraph.Graph-class.html#__init__" rel="nofollow">vertex attributes</a>, but I don't understand how to use it..</p>