original_docstring: Calculates the projected graph respect to a node list     
      Parameters:
          :kegg_graph (Graph): input graph, has to be generated via kegg_link_graph()
          :nodedict (dict): dict of nodes and nodetypes
          :multigraph (bool): if True 
          :name (str): optional name of the graph
          
      Returns:
          :projected_graph (Graph): projected graph
      .. seealso:: kegg_link_graph()
      
docstring: Calculates the projected graph respect to a node list
docstring_tokens: Calculates the projected graph respect to a node list
code: def projected_graph(graph, nodedict, multigraph=False, name=None):
      """Calculates the projected graph respect to a node list     
      Parameters:
          :kegg_graph (Graph): input graph, has to be generated via kegg_link_graph()
          :nodedict (dict): dict of nodes and nodetypes
          :multigraph (bool): if True 
          :name (str): optional name of the graph
          
      Returns:
          :projected_graph (Graph): projected graph
      .. seealso:: kegg_link_graph()
      """
      graphnodes_set = set(graph.nodes)
      nodelist_set = set(nodedict.keys())
  
      common_nodes = graphnodes_set & nodelist_set
  
      try:
          nodetype = graph.nodes[list(common_nodes)[0]]["nodetype"]
      except IndexError:
          raise NoProjectedError(graph)
  
      disjoint_nodes = nodelist_set - set(get_nodes_by_nodetype(graph, nodetype))
  
      projected_graph = nx.Graph.copy(nx.projected_graph(graph, common_nodes, multigraph))
  
      for dis_node in disjoint_nodes:
  
          projected_graph.add_node(dis_node, nodetype=nodetype, label = dis_node)
  
      if name == None:
          name = "{}_projected".format(graph.name)
      projected_graph.name = name
  
      return projected_graph
code_tokens: def projected_graph ( graph , nodedict , multigraph = False , name = None ) : graphnodes_set = set ( graph . nodes ) nodelist_set = set ( nodedict . keys ( ) ) common_nodes = graphnodes_set & nodelist_set try : nodetype = graph . nodes [ list ( common_nodes ) [ 0 ] ] [ "nodetype" ] except IndexError : raise NoProjectedError ( graph ) disjoint_nodes = nodelist_set - set ( get_nodes_by_nodetype ( graph , nodetype ) ) projected_graph = nx . Graph . copy ( nx . projected_graph ( graph , common_nodes , multigraph ) ) for dis_node in disjoint_nodes : projected_graph . add_node ( dis_node , nodetype = nodetype , label = dis_node ) if name == None : name = "{}_projected" . format ( graph . name ) projected_graph . name = name return projected_graph
short_docstring: Calculates the projected graph respect to a node list
short_docstring_tokens: Calculates the projected graph respect to a node list
comment: """Calculates the projected graph respect to a node list     
      Parameters:
          :kegg_graph (Graph): input graph, has to be generated via kegg_link_graph()
          :nodedict (dict): dict of nodes and nodetypes
          :multigraph (bool): if True 
          :name (str): optional name of the graph
          
      Returns:
          :projected_graph (Graph): projected graph
      .. seealso:: kegg_link_graph()
      """