arf_layout#
- arf_layout(G, pos=None, scaling=1, a=1.1, etol=1e-06, dt=0.001, max_iter=1000, *, seed=None)[source]#
Arf layout for networkx
The attractive and repulsive forces (arf) layout [1] improves the spring layout in three ways. First, it prevents congestion of highly connected nodes due to strong forcing between nodes. Second, it utilizes the layout space more effectively by preventing large gaps that spring layout tends to create. Lastly, the arf layout represents symmetries in the layout better than the default spring layout.
- Parameters:
- Gnx.Graph or nx.DiGraph
Networkx graph.
- posdict
Initial position of the nodes. If set to None a random layout will be used.
- scalingfloat
Scales the radius of the circular layout space.
- afloat
Strength of springs between connected nodes. Should be larger than 1. The greater a, the clearer the separation ofunconnected sub clusters.
- etolfloat
Gradient sum of spring forces must be larger than
etol
before successful termination.- dtfloat
Time step for force differential equation simulations.
- max_iterint
Max iterations before termination of the algorithm.
- seedint, RandomState instance or None optional (default=None)
Set the random state for deterministic node layouts. If int,
seed
is the seed used by the random number generator, if numpy.random.RandomState instance,seed
is the random number generator, if None, the random number generator is the RandomState instance used by numpy.random.- References
- .. [1] “Self-Organization Applied to Dynamic Network Layout”, M. Geipel,
International Journal of Modern Physics C, 2007, Vol 18, No 10, pp. 1537-1549. https://doi.org/10.1142/S0129183107011558 https://arxiv.org/abs/0704.1748
- Returns:
- posdict
A dictionary of positions keyed by node.
Examples
>>> G = nx.grid_graph((5, 5)) >>> pos = nx.arf_layout(G)