(objects, merged_morphisms)
return adjlists
Given the objects and the relevant morphisms of a diagram,
        returns the adjacency lists of the underlying undirected
        graph.
Given the objects and the relevant morphisms of a diagram,
        returns the adjacency lists of the underlying undirected
        graph.
Given the objects and the relevant morphisms of a diagram returns the adjacency lists of the underlying undirected graph .
def _get_undirected_graph(objects, merged_morphisms):
        """
        Given the objects and the relevant morphisms of a diagram,
        returns the adjacency lists of the underlying undirected
        graph.
        """
        adjlists = {}
        for obj in objects:
            adjlists[obj] = []

        for morphism in merged_morphisms:
            adjlists[morphism.domain].append(morphism.codomain)
            adjlists[morphism.codomain].append(morphism.domain)

        # Assure that the objects in the adjacency list are always in
        # the same order.
        for obj in adjlists.keys():
            adjlists[obj].sort(key=default_sort_key)

        return adjlists
def _get_undirected_graph ( objects , merged_morphisms ) : adjlists = { } for obj in objects : adjlists [ obj ] = [ ] for morphism in merged_morphisms : adjlists [ morphism . domain ] . append ( morphism . codomain ) adjlists [ morphism . codomain ] . append ( morphism . domain ) # Assure that the objects in the adjacency list are always in # the same order. for obj in adjlists . keys ( ) : adjlists [ obj ] . sort ( key = default_sort_key ) return adjlists