def graph_from_adjacency_matrix(matrix, node_prefix= '<STR_LIT>', directed=False):
node_orig = <NUM_LIT:1><EOL>if directed:<EOL><INDENT>graph = Dot(graph_type='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>graph = Dot(graph_type='<STR_LIT>')<EOL><DEDENT>for row in matrix:<EOL><INDENT>if not directed:<EOL><INDENT>skip = matrix.index(row)<EOL>r = row[skip:]<EOL><DEDENT>else:<EOL><INDENT>skip = <NUM_LIT:0><EOL>r = row<EOL><DEDENT>node_dest = skip+<NUM_LIT:1><EOL>for e in r:<EOL><INDENT>if e:<EOL><INDENT>graph.add_edge(<EOL>Edge( node_prefix + node_orig, <EOL>node_prefix + node_dest) )<EOL><DEDENT>node_dest += <NUM_LIT:1><EOL><DEDENT>node_orig += <NUM_LIT:1><EOL><DEDENT>return graph<EOL>
Creates a basic graph out of an adjacency matrix.

    The matrix has to be a list of rows of values
    representing an adjacency matrix.
    The values can be anything: bool, int, float, as long
    as they can evaluate to True or False.