<s> """<STR_LIT>""" <EOL> import networkx as nx <EOL> __author__ = """<STR_LIT:\n>""" . join ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> @ nx . utils . not_implemented_for ( '<STR_LIT>' ) <EOL> def is_arborescence ( G ) : <EOL> """<STR_LIT>""" <EOL> return is_tree ( G ) and max ( d for n , d in G . in_degree ( ) ) <= <NUM_LIT:1> <EOL> @ nx . utils . not_implemented_for ( '<STR_LIT>' ) <EOL> def is_branching ( G ) : <EOL> """<STR_LIT>""" <EOL> return is_forest ( G ) and max ( d for n , d in G . in_degree ( ) ) <= <NUM_LIT:1> <EOL> def is_forest ( G ) : <EOL> """<STR_LIT>""" <EOL> if len ( G ) == <NUM_LIT:0> : <EOL> raise nx . exception . NetworkXPointlessConcept ( '<STR_LIT>' ) <EOL> if G . is_directed ( ) : <EOL> components = nx . weakly_connected_component_subgraphs <EOL> else : <EOL> components = nx . connected_component_subgraphs <EOL> return all ( len ( c ) - <NUM_LIT:1> == c . number_of_edges ( ) for c in components ( G ) ) <EOL> def is_tree ( G ) : <EOL> """<STR_LIT>""" <EOL> if len ( G ) == <NUM_LIT:0> : <EOL> raise nx . exception . NetworkXPointlessConcept ( '<STR_LIT>' ) <EOL> if G . is_directed ( ) : <EOL> is_connected = nx . is_weakly_connected <EOL> else : <EOL> is_connected = nx . is_connected <EOL> return len ( G ) - <NUM_LIT:1> == G . number_of_edges ( ) and is_connected ( G ) </s>
