Skip to content

Instantly share code, notes, and snippets.

View MridulS's full-sized avatar
🌯
Send me burritos

Mridul Seth MridulS

🌯
Send me burritos
View GitHub Profile
@MridulS
MridulS / graphviews.py
Last active August 29, 2015 14:27 — forked from dschult/graphview.py
NodeView and EdgesView classes for NetworkX Graphs
from __future__ import print_function
class NodeView(object):
def __init__(self, graph, data=False):
self.G = graph
self.data = data
def __iter__(self):
if data:
return iter(self.G.node.items())
return iter(self.G.node)