class_docstr: A `DAGRepr` represents a complete DAG.
  
  Args:
      nodes (`Dict[str, NodeRepr]`): All nodes in the dag, which start with _input and end with _output node.
      edges (`Dict[int, List]`): The edges about data queue schema, such as:
                          { 0: {'data': [(a, ColumnType.SCALAR), (b, ColumnType.SCALAR)], 'schema': {'a', SchemaRepr, 'b', SchemaRepr}}
                            1: {'data': [(b, ColumnType.SCALAR), (c, ColumnType.SCALAR)], 'schema': {'b', SchemaRepr, 'c', SchemaRepr}}
                            2: {'data': [(a, ColumnType.SCALAR), (c, ColumnType.SCALAR)], 'schema': {'a', SchemaRepr, 'c', SchemaRepr}}
                          }
      dag_dict(`Dict`): The dag dict.
class_docstr_tok: ["A","`","DAGRepr","`","represents","a","complete","DAG",".","Args",":","nodes","(","`","Dict","[","str",",","NodeRepr","]","`",")",":","All","nodes","in","the","dag",",","which","start","with","_input","and","end","with","_output","node",".","edges","(","`","Dict","[","int",",","List","]","`",")",":","The","edges","about","data","queue","schema",",","such","as",":","{","0",":","{","'data","'",":","[","(","a",",","ColumnType.SCALAR",")",",","(","b",",","ColumnType.SCALAR",")","]",",","'schema","'",":","{","'","a","'",",","SchemaRepr",",","'","b","'",",","SchemaRepr","}","}","1",":","{","'data","'",":","[","(","b",",","ColumnType.SCALAR",")",",","(","c",",","ColumnType.SCALAR",")","]",",","'schema","'",":","{","'","b","'",",","SchemaRepr",",","'","c","'",",","SchemaRepr","}","}","2",":","{","'data","'",":","[","(","a",",","ColumnType.SCALAR",")",",","(","c",",","ColumnType.SCALAR",")","]",",","'schema","'",":","{","'","a","'",",","SchemaRepr",",","'","c","'",",","SchemaRepr","}","}","}","dag_dict","(","`","Dict","`",")",":","The","dag","dict","."]
docstr: Set in_edges and out_edges for the node, and return the nodes and edge.
  
  Args:
      nodes (`Dict[str, NodeRepr]`): All the nodes repr from DAG.
      top_sort (`list`): Topological list.
  
  Returns:
      Dict[str, NodeRepr]: The nodes update in_edges and out_edges.
      Dict[str, Dict]: The edges for the DAG.
docstr_tok: ["Set","in_edges","and","out_edges","for","the","node",",","and","return","the","nodes","and","edge",".","Args",":","nodes","(","`","Dict","[","str",",","NodeRepr","]","`",")",":","All","the","nodes","repr","from","DAG",".","top_sort","(","`","list","`",")",":","Topological","list",".","Returns",":","Dict","[","str",",","NodeRepr","]",":","The","nodes","update","in_edges","and","out_edges",".","Dict","[","str",",","Dict","]",":","The","edges","for","the","DAG","."]
code: def set_edges(nodes: Dict[str, NodeRepr], top_sort: list):
      """Set in_edges and out_edges for the node, and return the nodes and edge.
  
      Args:
          nodes (`Dict[str, NodeRepr]`): All the nodes repr from DAG.
          top_sort (`list`): Topological list.
  
      Returns:
          Dict[str, NodeRepr]: The nodes update in_edges and out_edges.
          Dict[str, Dict]: The edges for the DAG.
      """
      out_id = 0
      edges = {
          out_id: DAGRepr.get_edge_from_schema(
              nodes[InputConst.name].outputs,
              nodes[InputConst.name].inputs,
              nodes[InputConst.name].outputs,
              nodes[InputConst.name].iter_info.type,
              None,
          )
      }
      nodes[InputConst.name].in_edges = [out_id]
  
      for name in top_sort[:-1]:
          ahead_schema = set(nodes[name].outputs)
          for i in nodes[name].in_edges:
              ahead_schema = ahead_schema | edges[i]["schema"].keys()
          for next_name in nodes[name].next_nodes:
              out_id += 1
              out_schema = DAGRepr.dfs_used_schema(
                  nodes, next_name, ahead_schema
              )
              edges[out_id] = DAGRepr.get_edge_from_schema(
                  tuple(out_schema),
                  nodes[name].inputs,
                  nodes[name].outputs,
                  nodes[name].iter_info.type,
                  [edges[e]["schema"] for e in nodes[name].in_edges],
              )
  
              if nodes[next_name].in_edges is None:
                  nodes[next_name].in_edges = [out_id]
              else:
                  nodes[next_name].in_edges.append(out_id)
  
              if nodes[name].out_edges is None:
                  nodes[name].out_edges = [out_id]
              else:
                  nodes[name].out_edges.append(out_id)
  
      out_id += 1
      final_edge = nodes[OutputConst.name].in_edges[0]
      final_schema = edges[final_edge]["schema"]
      edges[out_id] = {
          "schema": final_schema,
          "data": [
              (s, final_schema[s].type)
              for s in nodes[OutputConst.name].inputs
          ],
      }
  
      nodes[OutputConst.name].out_edges = [out_id]
      return nodes, edges
  
imports: import types
  import uuid
  import json
  from copy import deepcopy
  from typing import Dict, Any, Set, List, Tuple, Optional
  from pydantic import BaseModel
  from towhee.runtime.check_utils import check_set, check_node_iter
  from towhee.runtime.node_repr import NodeRepr
  from towhee.runtime.schema_repr import SchemaRepr
  from towhee.runtime.node_config import TowheeConfig
  from towhee.runtime.constants import WindowAllConst, WindowConst, ConcatConst, MapConst, ReduceConst, FilterConst, TimeWindowConst, FlatMapConst, InputConst, OutputConst, OPType
label_desc: Use image node_id 8 for calling the DAGRepr obj's underlying member method code with example usage: obj.set_edges(nodes, top_sort) and returns: nodes,  edges