tools/android/dependency_analysis/graph.py
def add_edge_if_new(self, src: str, dest: str) -> bool:
        """Adds a directed edge to the graph.

        The source and destination nodes are created and added if they
        do not already exist. If the edge already exists in the graph,
        this is a no-op.

        Args:
            src: A unique key representing the source node.
            dest: A unique key representing the destination node.

        Returns:
            True if the edge was added (did not already exist), else False
        """
        src_node = self.add_node_if_new(src)
        dest_node = self.add_node_if_new(dest)

        # The following check is much faster than `if (src, dest) not in _edges`
        if dest_node not in src_node.outbound:
            src_node.add_outbound(dest_node)
            dest_node.add_inbound(src_node)
            self._edges.append((src_node, dest_node))
            return True
        return False
Adds a directed edge to the graph.

        The source and destination nodes are created and added if they
        do not already exist. If the edge already exists in the graph,
        this is a no-op.

        Args:
            src: A unique key representing the source node.
            dest: A unique key representing the destination node.

        Returns:
            True if the edge was added (did not already exist), else False
        
Adds a directed edge to the graph.
The source and destination nodes are created and added if they
do not already exist. If the edge already exists in the graph,
this is a no-op.
Adds a directed edge to the graph . The source and destination nodes are created and added if they do not already exist . If the edge already exists in the graph this is a no - op .
def add_edge_if_new(self, src: str, dest: str) -> bool:
        src_node = self.add_node_if_new(src)
        dest_node = self.add_node_if_new(dest)
        if dest_node not in src_node.outbound:
            src_node.add_outbound(dest_node)
            dest_node.add_inbound(src_node)
            self._edges.append((src_node, dest_node))
            return True
        return False
def add_edge_if_new ( self , src : str , dest : str ) -> bool : src_node = self . add_node_if_new ( src ) dest_node = self . add_node_if_new ( dest ) if dest_node not in src_node . outbound : src_node . add_outbound ( dest_node ) dest_node . add_inbound ( src_node ) self . _edges . append ( ( src_node , dest_node ) ) return True return False
Adds a directed edge to the graph.
Adds a directed edge to the graph .
"""Adds a directed edge to the graph.

        The source and destination nodes are created and added if they
        do not already exist. If the edge already exists in the graph,
        this is a no-op.

        Args:
            src: A unique key representing the source node.
            dest: A unique key representing the destination node.

        Returns:
            True if the edge was added (did not already exist), else False
        """ # The following check is much faster than `if (src, dest) not in _edges`
True if the edge was added (did not already exist), else False
True if the edge was added ( did not already exist ) else False
self
src
str
A unique key representing the source node.
A unique key representing the source node .
dest
str
A unique key representing the destination node.
A unique key representing the destination node .