def __init__(self, graph, node_set_size_limit=0):
    self.full_node_set = graph.nodes
    self.full_edge_set = graph.edges
    self.current_node_set = set()
    self.current_edge_set = set()
    self.visited_states = set()
    self.subgraphs = []
    self.node_set_size_limit = node_set_size_limit
    self.edges_by_source = defaultdict(set)
    self.edges_by_destination = defaultdict(set)
    self.edges_by_both = defaultdict(set)
    self.labels = defaultdict(list)
    for edge in self.full_edge_set:
        self.labels[(edge.from_node, edge.to_node)].append(edge)
        self.edges_by_source[edge.from_node].add(edge.to_node)
        self.edges_by_destination[edge.to_node].add(edge.from_node)
        self.edges_by_both[edge.from_node].add(edge.to_node)
        self.edges_by_both[edge.to_node].add(edge.from_node)
def __init__(self, graph, node_set_size_limit=0):
    self.full_node_set = graph.nodes
    self.full_edge_set = graph.edges
    self.current_node_set = set()
    self.current_edge_set = set()
    self.visited_states = set()
    self.subgraphs = []
    self.node_set_size_limit = node_set_size_limit
    self.edges_by_source = defaultdict(set)
    self.edges_by_destination = defaultdict(set)
    self.edges_by_both = defaultdict(set)
    self.labels = defaultdict(list)
    for edge in self.full_edge_set:
        self.labels[(edge.from_node, edge.to_node)].append(edge)
        self.edges_by_source[edge.from_node].add(edge.to_node)
        self.edges_by_destination[edge.to_node].add(edge.from_node)
        self.edges_by_both[edge.from_node].add(edge.to_node)
        self.edges_by_both[edge.to_node].add(edge.from_node)