code: def _construct_graph_from_dimacs_file(cls, f, directed=False):
      """Reads a graph from a file conforming to the DIMACS minimum-cost flow
      file format.
  
      For the exact definition of the format, see
      U{http://lpsolve.sourceforge.net/5.5/DIMACS.htm}.
  
      Restrictions compared to the official description of the format are
      as follows:
  
        - igraph's DIMACS reader requires only three fields in an arc
          definition, describing the edge's source and target node and
          its capacity.
        - Source vertices are identified by 's' in the FLOW field, target
          vertices are identified by 't'.
        - Node indices start from 1. Only a single source and target node
          is allowed.
  
      @param f: the name of the file or a Python file handle
      @param directed: whether the generated graph should be directed.
      @return: the generated graph. The indices of the source and target
        vertices are attached as graph attributes C{source} and C{target},
        the edge capacities are stored in the C{capacity} edge attribute.
      """
      # Deferred import to avoid cycles
      from igraph import Graph
  
      graph, source, target, cap = super(Graph, cls).Read_DIMACS(
          f, directed
      )
      graph.es["capacity"] = cap
      graph["source"] = source
      graph["target"] = target
      return graph
  
file_path: python-igraph/src/igraph/io/files.py
imports: import gzip
  import os
  from shutil import copyfileobj
  from warnings import warn
  from igraph._igraph import GraphBase
  from igraph.utils import named_temporary_file
label_desc: Use image node_id 3 for calling a global function with example usage: _construct_graph_from_dimacs_file(cls, f, directed) and returns: graph