def get_neighborhood_overlap(self, node1, node2, connection_type=None):
        """Get the intersection of two nodes's neighborhoods.

        Neighborhood is defined by parameter connection_type.
        :param Vertex node1: First node.
        :param Vertex node2: Second node.
        :param Optional[str] connection_type: One of direct or second-degree. Defaults to direct.
        :return: Overlap of the nodes' neighborhoods.
        """
        if connection_type is None or connection_type == "direct":
            order = 1
        elif connection_type == "second-degree":
            order = 2
        else:
            raise Exception(
                "Invalid option: {}. Valid options are direct and second-degree".format(
                    connection_type)
            )

        neighbors1 = self.graph.neighborhood(node1, order=order)
        neighbors2 = self.graph.neighborhood(node2, order=order)
        return set(neighbors1).intersection(neighbors2)
def get_neighborhood_overlap ( self , node1 , node2 , connection_type = None ) : if connection_type is None or connection_type == "direct" : order = 1 elif connection_type == "second-degree" : order = 2 else : raise Exception ( "Invalid option: {}. Valid options are direct and second-degree" . format ( connection_type ) ) neighbors1 = self . graph . neighborhood ( node1 , order = order ) neighbors2 = self . graph . neighborhood ( node2 , order = order ) return set ( neighbors1 ) . intersection ( neighbors2 )
Get the intersection of two nodes's neighborhoods.

        Neighborhood is defined by parameter connection_type.
        :param Vertex node1: First node.
        :param Vertex node2: Second node.
        :param Optional[str] connection_type: One of direct or second-degree. Defaults to direct.
        :return: Overlap of the nodes' neighborhoods.