1Graph::Easy::Layout::ChUasienr(3C)ontributed Perl DocumeGnrtaapthi:o:nEasy::Layout::Chain(3)
2
3
4
6 Graph::Easy::Layout::Chain - Chain of nodes for layouter
7
9 # used internally, do not use directly
10
11 use Graph::Easy;
12 use Graph::Easy::Layout::Chain;
13
14 my $graph = Graph::Easy->new( );
15 my ($node, $node2) = $graph->add_edge( 'A', 'B' );
16
17 my $chain = Graph::Easy::Layout::Chain->new(
18 start => $node,
19 graph => $graph, );
20
21 $chain->add_node( $node2 );
22
24 A "Graph::Easy::Layout::Chain" object represents a chain of nodes for
25 the layouter.
26
28 new()
29 my $chain = Graph::Easy::Layout::Chain->new( start => $node );
30
31 Create a new chain and set its starting node to $node.
32
33 length()
34 my $len = $chain->length();
35
36 Return the length of the chain, in nodes.
37
38 my $len = $chain->length( $node );
39
40 Given an optional $node as argument, returns the length from that node
41 onwards. For the chain with the three nodes A, B and C would return 3,
42 2, and 1 for A, B and C, respectively.
43
44 Returns 0 if the passed node is not part of this chain.
45
46 nodes()
47 my @nodes = $chain->nodes();
48
49 Return all the node objects in the chain as list, in order.
50
51 add_node()
52 $chain->add_node( $node );
53
54 Add $node to the end of the chain.
55
56 start()
57 my $node = $chain->start();
58
59 Return first node in the chain.
60
61 end()
62 my $node = $chain->end();
63
64 Return last node in the chain.
65
66 layout()
67 my $todo = $chain->layout();
68
69 Return an action stack as array ref, containing the nec. actions to
70 layout the chain (nodes, plus interlinks in the chain).
71
72 Will recursively traverse all chains linked to this chain.
73
74 merge()
75 my $chain->merge ( $other_chain );
76 my $chain->merge ( $other_chain, $where );
77
78 Merge the other chain into ourselves, adding its nodes at our end. The
79 other chain is emptied and must be deleted by the caller.
80
81 If $where is defined and a member of $other_chain, absorb only the
82 nodes from $where onwards, instead of all of them.
83
84 error()
85 $last_error = $node->error();
86
87 $node->error($error); # set new messages
88 $node->error(''); # clear error
89
90 Returns the last error message, or '' for no error.
91
92 dump()
93 $chain->dump();
94
95 Dump the chain to STDERR, to aid debugging.
96
98 None by default.
99
101 Graph::Easy, Graph::Easy::Layout.
102
104 Copyright (C) 2004 - 2006 by Tels <http://bloodgate.com>.
105
106 See the LICENSE file for more details.
107
108
109
110perl v5.28.0 2016-06-06 Graph::Easy::Layout::Chain(3)