Commit b67503a8 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Change default layout of graph_draw() to "sfdp" for large graphs

parent 5697be4a
......@@ -63,13 +63,13 @@ except ImportError:
__all__ = ["graph_draw", "arf_layout", "random_layout"]
def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
maxiter=None, ratio= "fill", overlap= "prism", sep=None,
def graph_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
maxiter=None, ratio="fill", overlap="prism", sep=None,
splines=False, vsize=0.1, penwidth=1.0, elen=None, gprops={},
vprops={}, eprops={}, vcolor=None, ecolor=None,
vcmap=matplotlib.cm.jet, vnorm=True, ecmap=matplotlib.cm.jet,
enorm=True, vorder=None, eorder=None, output= "",
output_format= "auto", returngv=False, fork=False,
enorm=True, vorder=None, eorder=None, output="",
output_format="auto", returngv=False, fork=False,
return_bitmap=False, seed=0):
r"""Draw a graph using graphviz.
......@@ -83,7 +83,7 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
Size (in centimeters) of the canvas.
pin : bool (default: False)
If True, the vertices are not moved from their initial position.
layout : string (default: "neato")
layout : string (default: "neato" if g.num_vertices() <= 1000 else "sfdp")
Layout engine to be used. Possible values are "neato", "fdp", "dot",
"circo", "twopi" and "arf".
maxiter : int (default: None)
......@@ -273,6 +273,9 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
else:
gvg = gv.graph("G")
if layout is None:
layout = "neato" if g.num_vertices() <= 1000 else "sfdp"
if layout == "arf":
layout = "neato"
pos = arf_layout(g, pos=pos)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment