Repository: networkx/networkx

Issue:
Passing arguments to graphviz_layout
It seems there is no way to pass arguments to the graphviz's programs, e.g.:
`pos = graphviz_layout(G, prog='dot', args='-Grankdir=LR')`
where G is a networkx graph.

I tried in different ways, like "args='-Grankdir=LR'" but "dot" is never affected by this.

Any idea?


Discussion:
Unfortunately, there are two versions of ```graphviz_layout``` in the networkx package. Which are you referring to?  It might be better to call them ```pydot_layout``` and/or ```pygraphviz_layout```.  Looking at the code, it seems that ```pydot_layout``` ignores any ```args``` while ```pygraphviz_layout``` at least forwards the ```args``` keywords on to the pygraphviz package.  It also seems to me that the doc_strings in ```pydot_layout``` and its version of the wrapper ```graphviz_layout``` should be updated to at least list the possible arguments correctly.

Resolving patch:
diff --git a/networkx/drawing/nx_agraph.py b/networkx/drawing/nx_agraph.py
--- a/networkx/drawing/nx_agraph.py
+++ b/networkx/drawing/nx_agraph.py
@@ -226,7 +226,8 @@ def graphviz_layout(G, prog='neato', root=None, args=''):
     args : string, optional
       Extra arguments to Graphviz layout program
 
-    Returns : dictionary
+    Returns
+    -------
       Dictionary of x, y, positions keyed by node.
 
     Examples
@@ -238,7 +239,6 @@ def graphviz_layout(G, prog='neato', root=None, args=''):
     Notes
     -----
     This is a wrapper for pygraphviz_layout.
-
     """
     return pygraphviz_layout(G, prog=prog, root=root, args=args)
 
diff --git a/networkx/drawing/nx_pydot.py b/networkx/drawing/nx_pydot.py
--- a/networkx/drawing/nx_pydot.py
+++ b/networkx/drawing/nx_pydot.py
@@ -235,11 +235,26 @@ def to_pydot(N):
     return P
 
 
-def graphviz_layout(G, prog='neato', root=None, **kwds):
+def graphviz_layout(G, prog='neato', root=None):
     """Create node positions using Pydot and Graphviz.
 
     Returns a dictionary of positions keyed by node.
 
+    Parameters
+    ----------
+    G : NetworkX Graph
+        The graph for which the layout is computed.
+    prog : string (default: 'neato')
+        The name of the GraphViz program to use for layout.
+        Options depend on GraphViz version but may include:
+        'dot', 'twopi', 'fdp', 'sfdp', 'circo'
+    root : Node from G or None (default: None)
+        The node of G from which to start some layout algorithms.
+
+    Returns
+    -------
+      Dictionary of (x, y) positions keyed by node.
+
     Examples
     --------
     >>> G = nx.complete_graph(4)
@@ -250,23 +265,22 @@ def graphviz_layout(G, prog='neato', root=None, **kwds):
     -----
     This is a wrapper for pydot_layout.
     """
-    return pydot_layout(G=G, prog=prog, root=root, **kwds)
+    return pydot_layout(G=G, prog=prog, root=root)
 
 
-# FIXME: Document the "root" parameter.
-# FIXME: Why does this function accept a variadic dict of keyword arguments
-# (i.e., "**kwds") but fail to do anything with them? This is probably
-# wrong, as unrecognized keyword arguments will be silently ignored.
-def pydot_layout(G, prog='neato', root=None, **kwds):
+def pydot_layout(G, prog='neato', root=None):
     """Create node positions using :mod:`pydot` and Graphviz.
 
     Parameters
     --------
     G : Graph
         NetworkX graph to be laid out.
-    prog : optional[str]
-        Basename of the GraphViz command with which to layout this graph.
-        Defaults to `neato`: default GraphViz command for undirected graphs.
+    prog : string  (default: 'neato')
+        Name of the GraphViz command to use for layout.
+        Options depend on GraphViz version but may include:
+        'dot', 'twopi', 'fdp', 'sfdp', 'circo'
+    root : Node from G or None (default: None)
+        The node of G from which to start some layout algorithms.
 
     Returns
     --------


Test patch: