1Graph::Easy::Layout::PaUtshe(r3)Contributed Perl DocumenGtraatpiho:n:Easy::Layout::Path(3)
2
3
4
6 Graph::Easy::Layout::Path - Path management for Manhattan-style grids
7
9 use Graph::Easy;
10
11 my $graph = Graph::Easy->new();
12
13 my $bonn = Graph::Easy::Node->new(
14 name => 'Bonn',
15 );
16 my $berlin = Graph::Easy::Node->new(
17 name => 'Berlin',
18 );
19
20 $graph->add_edge ($bonn, $berlin);
21
22 $graph->layout();
23
24 print $graph->as_ascii( );
25
26 # prints:
27
28 # +------+ +--------+
29 # | Bonn | --> | Berlin |
30 # +------+ +--------+
31
33 "Graph::Easy::Layout::Scout" contains just the actual path-managing
34 code for Graph::Easy, e.g. to create/destroy/maintain paths, node
35 placement etc.
36
38 Exports nothing.
39
41 Graph::Easy.
42
44 This module injects the following methods into "Graph::Easy":
45
46 _path_is_clear()
47 $graph->_path_is_clear($path);
48
49 For all points (x,y pairs) in the path, check that the cell is still
50 free. $path points to a list x,y,type pairs as in "[ [x,y,type],
51 [x,y,type], ...]".
52
53 _create_cell()
54 my $cell = $graph->($edge,$x,$y,$type);
55
56 Create a cell at "$x,$y" coordinates with type $type for the specified
57 edge.
58
59 _path_is_clear()
60 $graph->_path_is_clear();
61
62 For all points (x,y pairs) in the path, check that the cell is still
63 free. $path points to a list of "[ x,y,type, x,y,type, ...]".
64
65 Returns true when the path is clear, false otherwise.
66
67 _trace_path()
68 my $path = my $graph->_trace_path($src,$dst,$edge);
69
70 Find a free way from source node/group to destination node/group for
71 the specified edge. Both source and destination need to be placed
72 beforehand.
73
75 This module injects the following methods into "Graph::Easy::Node":
76
77 _near_places()
78 my $node->_near_places();
79
80 Take a node and return a list of possible placements around it and
81 prune out already occupied cells. $d is the distance from the node
82 border and defaults to two (for placements). Set it to one for adjacent
83 cells.
84
85 _shuffle_dir()
86 my $dirs = $node->_shuffle_dir( [ 0,1,2,3 ], $dir);
87
88 Take a ref to an array with four entries and shuffle them around
89 according to $dir.
90
91 _shift()
92 my $dir = $node->_shift($degrees);
93
94 Return a the "flow()" direction shifted by X degrees to $dir.
95
97 Copyright (C) 2004 - 2007 by Tels <http://bloodgate.com>.
98
99 See the LICENSE file for information.
100
101
102
103perl v5.36.0 2022-07-22 Graph::Easy::Layout::Path(3)