def pygraphviz_layout(G,prog='neato',root=None, args=''):
    """Create node positions for G using Graphviz.

    Parameters
    ----------
    G : NetworkX graph
      A graph created with NetworkX
    prog : string
      Name of Graphviz layout program
    root : string, optional
      Root node for twopi layout
    args : string, optional
      Extra arguments to Graphviz layout program

    Returns : dictionary
      Dictionary of x,y, positions keyed by node.

    Examples
    --------
    >>> G=nx.petersen_graph()
    >>> pos=nx.graphviz_layout(G)
    >>> pos=nx.graphviz_layout(G,prog='dot')

    """
    try:
        import pygraphviz
    except __HOLE__:
        raise ImportError('requires pygraphviz ',
                          'http://networkx.lanl.gov/pygraphviz ',
                          '(not available for Python3)')
    if root is not None:
        args+="-Groot=%s"%root
    A=to_agraph(G)
    A.layout(prog=prog,args=args)
    node_pos={}
    for n in G:
        node=pygraphviz.Node(A,n)
        try:
            xx,yy=node.attr["pos"].split(',')
            node_pos[n]=(float(xx),float(yy))
        except:
            print("no position for node",n)
            node_pos[n]=(0.0,0.0)
    return node_pos
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/drawing/nx_agraph.py/pygraphviz_layout