First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2 years ago

Max Alekseyev gravatar image

Try this:

len(set.union(*(set(G.neighbors(v)) for v in V)))

where V is the subset of vertices of G.

click to hide/show revision 2
No.2 Revision

Try this:

len(set.union(*(set(G.neighbors(v)) for v in V)))

where V is the a given subset of vertices of G.