0
|
1 NAME
|
|
2 Path - Path class
|
|
3
|
|
4 SYNOPSIS
|
|
5 use Graph::Path;
|
|
6
|
|
7 use Graph::Path qw(:all);
|
|
8
|
|
9 DESCRIPTION
|
|
10 Path class provides the following methods:
|
|
11
|
|
12 new, AddVertex, AddVertices, Copy, GetCommonVertices, GetEdges,
|
|
13 GetEndVertex, GetLength, GetStartVertex, GetTerminalVertices, GetVertex,
|
|
14 GetVertices, IsCycle, IsIndependentCyclicPath, IsIndependentPath,
|
|
15 IsPath, Join, JoinAtVertex, PopVertex, PushVertex, PushVertices,
|
|
16 Reverse, ShiftVertex, StringifyPath, UnshiftVertex, UnshiftVertices
|
|
17
|
|
18 Path is a sequential list of vertices with an edge between two
|
|
19 successive vertices. The path becomes a cycle when start vertex and end
|
|
20 vertex are the same.
|
|
21
|
|
22 The following operators are overloaded:
|
|
23
|
|
24 "" == eq
|
|
25
|
|
26 METHODS
|
|
27 new
|
|
28 $NewPath = new Path();
|
|
29 $NewPath = new Path(@VertexIDs);
|
|
30
|
|
31 Using specified *VertexIDs*, new method creates a new Path object
|
|
32 and returns newly created Path object.
|
|
33
|
|
34 AddVertex
|
|
35 $Path->AddVertex($VertexID);
|
|
36
|
|
37 Adds *VertexID* to *Path* and returns *Path*.
|
|
38
|
|
39 AddVertices
|
|
40 $Path->AddVertices(@VertexIDs);
|
|
41
|
|
42 Adds vertices using *VertexIDs* to *Path* and returns *Graph*.
|
|
43
|
|
44 Copy
|
|
45 $Return = $Path->Copy();
|
|
46
|
|
47 Copies *Path* and its associated data using Storable::dclone and
|
|
48 returns a new Path object.
|
|
49
|
|
50 GetCommonVertices
|
|
51 @CommonVertices = $Path->GetCommonVertices($OtherPath);
|
|
52 $NumOfCommonVertices = $Path->GetCommonVertices($OtherPath);
|
|
53
|
|
54 Returns an array containing common vertex IDs between two paths. In
|
|
55 scalar context, number of common vertices is returned.
|
|
56
|
|
57 GetEdges
|
|
58 @EdgesVertexIDs = $Path->GetEdges();
|
|
59 $NumOfEdges = $Path->GetEdges();
|
|
60
|
|
61 Returns an array containg successive paris of vertex IDs
|
|
62 corresponding to all edges in *Path*. In scalar context, the number
|
|
63 of edges is returned.
|
|
64
|
|
65 GetEndVertex
|
|
66 $VertexID = $Path->GetEndVertex();
|
|
67
|
|
68 Returns VertexID of end vertex in *Path*.
|
|
69
|
|
70 GetLength
|
|
71 $Length = $Path->GetLength();
|
|
72
|
|
73 Returns Length of *Path* corresponding to number of vertices in
|
|
74 *Path*.
|
|
75
|
|
76 GetStartVertex
|
|
77 $VertexID = $Path->GetStartVertex();
|
|
78
|
|
79 Returns VertexID of start vertex in *Path*.
|
|
80
|
|
81 GetTerminalVertices
|
|
82 ($StartVertexID, $EndVertexID) = $Path->GetTerminalVertices();
|
|
83
|
|
84 Returns vertex IDs of start and end vertices in *Path*.
|
|
85
|
|
86 GetVertex
|
|
87 $VertexID = $Path->GetVertex($Index);
|
|
88
|
|
89 Returns specific vertex ID from *Path* corresponding to *Index* with
|
|
90 indicies starting from 0.
|
|
91
|
|
92 GetVertices
|
|
93 @Vertices = $Path->GetVertices();
|
|
94 $NumOfVertices = $Path->GetVertices();
|
|
95
|
|
96 Returns an array containing all vertex IDs in *Path*. In scalar
|
|
97 context, number of vertices is returned.
|
|
98
|
|
99 IsCycle
|
|
100 $Status = $Path->IsCycle();
|
|
101
|
|
102 Returns 1 or 0 based on whether *Path* is a CyclicPath which has the
|
|
103 same start and end vertex IDs.
|
|
104
|
|
105 IsIndependentCyclicPath
|
|
106 $Status = $Path->IsIndependentCyclicPath();
|
|
107
|
|
108 Returns 1 or 0 based on whether *Path* is an independent CyclicPath.
|
|
109 For a *Path* to be an independent cyclic path, it must be a cyclic
|
|
110 path and have unique vertices.
|
|
111
|
|
112 IsIndependentPath
|
|
113 $Status = $Path->IsIndependentPath();
|
|
114
|
|
115 Returns 1 or 0 based on whether *Path* is an independent Path. For a
|
|
116 *Path* to be an independent path, it must have unique vertices.
|
|
117
|
|
118 IsPath
|
|
119 $Status = Graph::Path::IsPath();
|
|
120
|
|
121 Returns 1 or 0 based on whether *Object* is a Path object
|
|
122
|
|
123 Join
|
|
124 $NewPath = $Path->Join($OtherPath);
|
|
125 $NewPath = $Path->Join(@VertexIDs);
|
|
126
|
|
127 Joins existing *Path* with a new path specified as a *OtherPath*
|
|
128 object or an array of *VertexIDs* and returns *NewPath*.
|
|
129
|
|
130 In order to successfully join two paths, terminal vertices must have
|
|
131 a common vertex. Based on the common terminal vertex found,
|
|
132 additional path vertices are added to the current *Path* in one of
|
|
133 the following four ways:
|
|
134
|
|
135 . EndVertex = NewStartVertex: New path at end of current path with
|
|
136 same vertices order
|
|
137
|
|
138 . EndVertex = NewEndVertex: New path at end of current path with
|
|
139 reversed vertices order
|
|
140
|
|
141 . StartVertex = NewEndVertex: New path at front of current path
|
|
142 with same vertices order
|
|
143
|
|
144 . StartVertex = NewStartVertex: New path at front of current path
|
|
145 with reversed vertices order
|
|
146
|
|
147 JoinAtVertex
|
|
148 $NewPath = $Path->JoinAtVertex($OtherPath, $CenterVertexID);
|
|
149
|
|
150 Joins existing *Path* with *OtherPath* at a specified
|
|
151 *CeterVertexID* and returns a *NewPath*.
|
|
152
|
|
153 PopVertex
|
|
154 $Path->PopVertex();
|
|
155
|
|
156 Removes end vertex from *Path* and returns *Path*.
|
|
157
|
|
158 PushVertex
|
|
159 $Path->PushVertex($VertexID);
|
|
160
|
|
161 Adds *VertexID* to *Path* after end vertex and returns *Path*.
|
|
162
|
|
163 PushVertices
|
|
164 $Path->PushVertices(@VertexIDs);
|
|
165
|
|
166 Adds *VertexIDs* to *Path* after end vertex and returns *Path*.
|
|
167
|
|
168 Reverse
|
|
169 $Path->Reverse();
|
|
170
|
|
171 Reverses order of vertices in *Path* and returns *Path*.
|
|
172
|
|
173 ShiftVertex
|
|
174 $Path->ShiftVertex();
|
|
175
|
|
176 Removes start vertex from *Path* and returns *Path*.
|
|
177
|
|
178 StringifyPath
|
|
179 $String = $Path->StringifyPath();
|
|
180
|
|
181 Returns a string containing information about *Path* object.
|
|
182
|
|
183 UnshiftVertex
|
|
184 $Path->UnshiftVertex($VertexID);
|
|
185
|
|
186 Adds *VertexID* to *Path* before start vertex and returns *Path*.
|
|
187
|
|
188 UnshiftVertices
|
|
189 $Path->UnshiftVertices(@VertexIDs);
|
|
190
|
|
191 Adds *VertexIDs* to *Path* before start vertex and returns *Path*.
|
|
192
|
|
193 AUTHOR
|
|
194 Manish Sud <msud@san.rr.com>
|
|
195
|
|
196 SEE ALSO
|
|
197 PathGraph.pm, PathsTraversal.pm
|
|
198
|
|
199 COPYRIGHT
|
|
200 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
201
|
|
202 This file is part of MayaChemTools.
|
|
203
|
|
204 MayaChemTools is free software; you can redistribute it and/or modify it
|
|
205 under the terms of the GNU Lesser General Public License as published by
|
|
206 the Free Software Foundation; either version 3 of the License, or (at
|
|
207 your option) any later version.
|
|
208
|