(
        cls, f, sep=None, comment_char="#", attribute=None, *args, **kwds
    )
return graph
Constructs a graph based on an adjacency matrix from the given file.

        Additional positional and keyword arguments not mentioned here are
        passed intact to L{Adjacency}.

        @param f: the name of the file to be read or a file object
        @param sep: the string that separates the matrix elements in a row.
          C{None} means an arbitrary sequence of whitespace characters.
        @param comment_char: lines starting with this string are treated
          as comments.
        @param attribute: an edge attribute name where the edge weights are
          stored in the case of a weighted adjacency matrix. If C{None},
          no weights are stored, values larger than 1 are considered as
          edge multiplicities.
        @return: the created graph
Constructs a graph based on an adjacency matrix from the given file.
Constructs a graph based on an adjacency matrix from the given file .
def Read_Adjacency(
        cls, f, sep=None, comment_char="#", attribute=None, *args, **kwds
    ):
        """Constructs a graph based on an adjacency matrix from the given file.

        Additional positional and keyword arguments not mentioned here are
        passed intact to L{Adjacency}.

        @param f: the name of the file to be read or a file object
        @param sep: the string that separates the matrix elements in a row.
          C{None} means an arbitrary sequence of whitespace characters.
        @param comment_char: lines starting with this string are treated
          as comments.
        @param attribute: an edge attribute name where the edge weights are
          stored in the case of a weighted adjacency matrix. If C{None},
          no weights are stored, values larger than 1 are considered as
          edge multiplicities.
        @return: the created graph"""
        if isinstance(f, str):
            f = open(f)

        matrix, ri = [], 0
        for line in f:
            line = line.strip()
            if len(line) == 0:
                continue
            if line.startswith(comment_char):
                continue
            row = [float(x) for x in line.split(sep)]
            matrix.append(row)
            ri += 1

        f.close()

        if attribute is None:
            graph = cls.Adjacency(matrix, *args, **kwds)
        else:
            kwds["attr"] = attribute
            graph = cls.Weighted_Adjacency(matrix, *args, **kwds)

        return graph
def Read_Adjacency ( cls , f , sep = None , comment_char = "#" , attribute = None , * args , * * kwds ) : if isinstance ( f , str ) : f = open ( f ) matrix , ri = [ ] , 0 for line in f : line = line . strip ( ) if len ( line ) == 0 : continue if line . startswith ( comment_char ) : continue row = [ float ( x ) for x in line . split ( sep ) ] matrix . append ( row ) ri += 1 f . close ( ) if attribute is None : graph = cls . Adjacency ( matrix , * args , * * kwds ) else : kwds [ "attr" ] = attribute graph = cls . Weighted_Adjacency ( matrix , * args , * * kwds ) return graph