(expr, atom=lambda x: not isinstance(x, Basic), pos=(), repeat=True)
List of strings for all expr->expr.arg pairs

    See the docstring of dotprint for explanations of the options.

    >>> from sympy.printing.dot import dotedges
    >>> from sympy.abc import x
    >>> for e in dotedges(x+2):
    ...     print(e)
    "Add(Integer(2), Symbol(x))_()" -> "Integer(2)_(0,)";
    "Add(Integer(2), Symbol(x))_()" -> "Symbol(x)_(1,)";
List of strings for all expr->expr.arg pairs
List of strings for all expr - > expr . arg pairs
def dotedges(expr, atom=lambda x: not isinstance(x, Basic), pos=(), repeat=True):
    """ List of strings for all expr->expr.arg pairs

    See the docstring of dotprint for explanations of the options.

    >>> from sympy.printing.dot import dotedges
    >>> from sympy.abc import x
    >>> for e in dotedges(x+2):
    ...     print(e)
    "Add(Integer(2), Symbol(x))_()" -> "Integer(2)_(0,)";
    "Add(Integer(2), Symbol(x))_()" -> "Symbol(x)_(1,)";
    """
    if atom(expr):
        return []
    else:
        # TODO: This is quadratic in complexity (purestr(expr) already
        # contains [purestr(arg) for arg in expr.args]).
        expr_str = purestr(expr)
        arg_strs = [purestr(arg) for arg in expr.args]
        if repeat:
            expr_str += '_%s' % str(pos)
            arg_strs = [arg_str + '_%s' % str(pos + (i,)) for i, arg_str in enumerate(arg_strs)]
        return ['"%s" -> "%s";'%(expr_str, arg_str) for arg_str in arg_strs]
def dotedges ( expr , atom = lambda x : not isinstance ( x , Basic ) , pos = ( ) , repeat = True ) : if atom ( expr ) : return [ ] else : # TODO: This is quadratic in complexity (purestr(expr) already # contains [purestr(arg) for arg in expr.args]). expr_str = purestr ( expr ) arg_strs = [ purestr ( arg ) for arg in expr . args ] if repeat : expr_str += '_%s' % str ( pos ) arg_strs = [ arg_str + '_%s' % str ( pos + ( i , ) ) for i , arg_str in enumerate ( arg_strs ) ] return [ '"%s" -> "%s";' % ( expr_str , arg_str ) for arg_str in arg_strs ]