class_docstr: Network visualization "renderer" implementation to render a network to a
  dot-formatted document, suitable for use w/ graphviz.
  
  :param outp: File-like obj to which rendered graph is written (defaults to
         sys.stdout)
  :param node_attrs: Node attributes to apply to all nodes in graph
class_docstr_tok: ["Network","visualization","``","renderer","''","implementation","to","render","a","network","to","a","dot-formatted","document",",","suitable","for","use","w\/","graphviz",".",":","param","outp",":","File-like","obj","to","which","rendered","graph","is","written","(","defaults","to","sys.stdout",")",":","param","node_attrs",":","Node","attributes","to","apply","to","all","nodes","in","graph"]
code: def render(self, graph):
      self.outp.write("digraph structs {\n")
      self.outp.write('rankdir = "LR";\n')
  
      lookup = {}
  
      for edge in graph.edges():
          data = graph.get_edge_data(*edge)
  
          lookup.setdefault(
              edge[0], {"inputs": set(), "outputs": set()}
          )
          lookup.setdefault(
              edge[1], {"inputs": set(), "outputs": set()}
          )
  
          for labels in data.values():
              lookup[edge[0]]["outputs"].add(labels["src"])
              lookup[edge[1]]["inputs"].add(labels["dest"])
              self.outp.write(
                  '"{}":{} -> "{}":{};\n'.format(
                      edge[0], labels["src"], edge[1], labels["dest"]
                  )
              )
  
      def _renderPorts(ports):
          return (
              "{"
              + "|".join("<{}>{}".format(port, port) for port in ports)
              + "}"
          )
  
      for node, ports in lookup.items():
  
          def _renderNode():
              nodeAttrs = ",".join(
                  "{}={}".format(key, value)
                  for key, value in self.node_attrs.items()
              )
              nodeAttrs += "," if nodeAttrs else ""
  
              return '{} [{}label="{}"];\n'.format(
                  node,
                  nodeAttrs,
                  "{"
                  + "|".join(
                      [
                          _renderPorts(ports["inputs"]),
                          node,
                          _renderPorts(ports["outputs"]),
                      ]
                  )
                  + "}",
              )
  
          self.outp.write(unicode(_renderNode()))
  
      self.outp.write("}\n")
  
imports: import sys
label_desc: Use image node_id 2 for calling the DotRenderer obj's underlying member method code with example usage: obj.render(graph) and returns: unknown, str