(self, var_def, simplified_graph=True)
return sources
Find all sources to the specified variable definition.

        :param ProgramVariable var_def: The variable definition.
        :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
        :return: A collection of all sources to the specified variable definition.
        :rtype: list
Find all sources to the specified variable definition.
Find all sources to the specified variable definition .
def find_sources(self, var_def, simplified_graph=True):
        """
        Find all sources to the specified variable definition.

        :param ProgramVariable var_def: The variable definition.
        :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
        :return: A collection of all sources to the specified variable definition.
        :rtype: list
        """

        if simplified_graph:
            graph = self.simplified_data_graph
        else:
            graph = self.data_graph

        if var_def not in graph:
            return []

        sources = []
        defs = [ var_def ]
        traversed = set()

        while defs:
            definition = defs.pop()
            in_edges = graph.in_edges(definition, data=True)
            for src, _, data in in_edges:
                if 'type' in data and data['type'] == 'kill':
                    continue
                if isinstance(src.variable, SimTemporaryVariable):
                    if src not in traversed:
                        defs.append(src)
                        traversed.add(src)
                else:
                    if src not in sources:
                        sources.append(src)

        return sources
def find_sources ( self , var_def , simplified_graph = True ) : if simplified_graph : graph = self . simplified_data_graph else : graph = self . data_graph if var_def not in graph : return [ ] sources = [ ] defs = [ var_def ] traversed = set ( ) while defs : definition = defs . pop ( ) in_edges = graph . in_edges ( definition , data = True ) for src , _ , data in in_edges : if 'type' in data and data [ 'type' ] == 'kill' : continue if isinstance ( src . variable , SimTemporaryVariable ) : if src not in traversed : defs . append ( src ) traversed . add ( src ) else : if src not in sources : sources . append ( src ) return sources