def node_attribute_xy(G, attribute, nodes=None):
 if (nodes is None):
  nodes = set(G)
 else:
  nodes = set(nodes)
 node = G.node
 for (u, nbrsdict) in G.adjacency():
  if (u not in nodes):
   continue
  uattr = node[u].get(attribute, None)
  if G.is_multigraph():
   for (v, keys) in nbrsdict.items():
    vattr = node[v].get(attribute, None)
    for (k, d) in keys.items():
     (yield (uattr, vattr))
  else:
   for (v, eattr) in nbrsdict.items():
    vattr = node[v].get(attribute, None)
    (yield (uattr, vattr))

def node_attribute_xy ( G , attribute , nodes = None ) : if ( nodes is None ) : nodes = set ( G ) else : nodes = set ( nodes ) node = G . node for ( u , nbrsdict ) in G . adjacency ( ) : if ( u not in nodes ) : continue uattr = node [ u ] . get ( attribute , None ) if G . is_multigraph ( ) : for ( v , keys ) in nbrsdict . items ( ) : vattr = node [ v ] . get ( attribute , None ) for ( k , d ) in keys . items ( ) : ( yield ( uattr , vattr ) ) else : for ( v , eattr ) in nbrsdict . items ( ) : vattr = node [ v ] . get ( attribute , None ) ( yield ( uattr , vattr ) )
return iterator of node-attribute pairs for all edges in g .