1Graph::Easy::Layout::FoUrsceer(3C)ontributed Perl DocumeGnrtaapthi:o:nEasy::Layout::Force(3)
2
3
4
6 Graph::Easy::Layout::Force - Force-based layouter for Graph::Easy
7
9 use Graph::Easy;
10
11 my $graph = Graph::Easy->new();
12
13 $graph->add_edge ('Bonn', 'Berlin');
14 $graph->add_edge ('Bonn', 'Ulm');
15 $graph->add_edge ('Ulm', 'Berlin');
16
17 $graph->layout( type => 'force' );
18
19 print $graph->as_ascii( );
20
21 # prints:
22
23 # +------------------------+
24 # | v
25 # +------+ +-----+ +--------+
26 # | Bonn | --> | Ulm | --> | Berlin |
27 # +------+ +-----+ +--------+
28
30 "Graph::Easy::Layout::Force" contains routines that calculate a force-
31 based layout for a graph.
32
33 Nodes repell each other, while edges connecting them draw them
34 together.
35
36 The layouter calculates the forces on each node, then moves them around
37 according to these forces until things have settled down.
38
39 Used automatically by Graph::Easy.
40
42 Exports nothing.
43
45 Graph::Easy.
46
48 This module injects the following methods into Graph::Easy:
49
50 _layout_force()
51 Calculates the node position with a force-based method.
52
54 Copyright (C) 2004 - 2007 by Tels <http://bloodgate.com>.
55
56 See the LICENSE file for information.
57
58
59
60perl v5.28.0 2016-06-06 Graph::Easy::Layout::Force(3)