(self, source, target, label, event, attributes=None)
Add edge to graph.

        Args:
            source: (Node) Node to use as source.
            target: (Node) Node to use as target.
            label: (str) Label for the node.
            event: (dict): OpenSearch event.
            attributes: (dict) Attributes to add to node.
Add edge to graph.
Add edge to graph .
def add_edge(self, source, target, label, event, attributes=None):
        """Add edge to graph.

        Args:
            source: (Node) Node to use as source.
            target: (Node) Node to use as target.
            label: (str) Label for the node.
            event: (dict): OpenSearch event.
            attributes: (dict) Attributes to add to node.
        """
        if not attributes:
            attributes = {}

        attributes['id'] = ''.join([source.id, target.id, label]).lower()

        edge = Edge(source, target, label, attributes)

        if edge.node_counter < MAX_EVENTS_PER_EDGE:
            index = event.get('_index')
            doc_id = event.get('_id')
            events = edge.attributes.get('events', {})
            doc_ids = events.get(index, [])
            doc_ids.append(doc_id)
            edge.node_counter += 1
            events[index] = doc_ids
            edge.set_attribute('events', events)

        self._edges[edge.id] = edge
def add_edge ( self , source , target , label , event , attributes = None ) : if not attributes : attributes = { } attributes [ 'id' ] = '' . join ( [ source . id , target . id , label ] ) . lower ( ) edge = Edge ( source , target , label , attributes ) if edge . node_counter < MAX_EVENTS_PER_EDGE : index = event . get ( '_index' ) doc_id = event . get ( '_id' ) events = edge . attributes . get ( 'events' , { } ) doc_ids = events . get ( index , [ ] ) doc_ids . append ( doc_id ) edge . node_counter += 1 events [ index ] = doc_ids edge . set_attribute ( 'events' , events ) self . _edges [ edge . id ] = edge