(self, f, source=None, target=None, capacity="capacity")
return GraphBase.write_dimacs(self, f, source, target, capacity)
Writes the graph in DIMACS format to the given file.

        @param f: the name of the file to be written or a Python file handle.
        @param source: the source vertex ID. If C{None}, igraph will try to
          infer it from the C{source} graph attribute.
        @param target: the target vertex ID. If C{None}, igraph will try to
          infer it from the C{target} graph attribute.
        @param capacity: the capacities of the edges in a list or the name of
          an edge attribute that holds the capacities. If there is no such
          edge attribute, every edge will have a capacity of 1.
Writes the graph in DIMACS format to the given file.
Writes the graph in DIMACS format to the given file .
def write_dimacs(self, f, source=None, target=None, capacity="capacity"):
        """Writes the graph in DIMACS format to the given file.

        @param f: the name of the file to be written or a Python file handle.
        @param source: the source vertex ID. If C{None}, igraph will try to
          infer it from the C{source} graph attribute.
        @param target: the target vertex ID. If C{None}, igraph will try to
          infer it from the C{target} graph attribute.
        @param capacity: the capacities of the edges in a list or the name of
          an edge attribute that holds the capacities. If there is no such
          edge attribute, every edge will have a capacity of 1.
        """
        if source is None:
            try:
                source = self["source"]
            except KeyError:
                raise ValueError(
                    "source vertex must be provided in the 'source' graph "
                    "attribute or in the 'source' argument of write_dimacs()"
                )

        if target is None:
            try:
                target = self["target"]
            except KeyError:
                raise ValueError(
                    "target vertex must be provided in the 'target' graph "
                    "attribute or in the 'target' argument of write_dimacs()"
                )

        if isinstance(capacity, str) and capacity not in self.edge_attributes():
            warn("'%s' edge attribute does not exist" % capacity)
            capacity = [1] * self.ecount()

        return GraphBase.write_dimacs(self, f, source, target, capacity)
def write_dimacs ( self , f , source = None , target = None , capacity = "capacity" ) : if source is None : try : source = self [ "source" ] except KeyError : raise ValueError ( "source vertex must be provided in the 'source' graph " "attribute or in the 'source' argument of write_dimacs()" ) if target is None : try : target = self [ "target" ] except KeyError : raise ValueError ( "target vertex must be provided in the 'target' graph " "attribute or in the 'target' argument of write_dimacs()" ) if isinstance ( capacity , str ) and capacity not in self . edge_attributes ( ) : warn ( "'%s' edge attribute does not exist" % capacity ) capacity = [ 1 ] * self . ecount ( ) return GraphBase . write_dimacs ( self , f , source , target , capacity )