def is_closed ( self ) : closed = all ( i == 2 for i in dict ( self . vertex_graph . degree ( ) ) . values ( ) ) return closed
python test graph connected components
Are all entities connected to other entities .
def is_closed(self):
        """
        Are all entities connected to other entities.

        Returns
        -----------
        closed : bool
          Every entity is connected at its ends
        """
        closed = all(i == 2 for i in
                     dict(self.vertex_graph.degree()).values())

        return closed