comparison mayachemtools/docs/modules/html/Path.html @ 0:73ae111cf86f draft

Uploaded
author deepakjadmin
date Wed, 20 Jan 2016 11:55:01 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:73ae111cf86f
1 <html>
2 <head>
3 <title>MayaChemTools:Documentation:Graph::Path.pm</title>
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
6 </head>
7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
8 <br/>
9 <center>
10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
11 </center>
12 <br/>
13 <div class="DocNav">
14 <table width="100%" border=0 cellpadding=0 cellspacing=2>
15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./GraphMatrix.html" title="GraphMatrix.html">Previous</a>&nbsp;&nbsp;<a href="./index.html" title="Table of Contents">TOC</a>&nbsp;&nbsp;<a href="./PathGraph.html" title="PathGraph.html">Next</a></td><td width="34%" align="middle"><strong>Graph::Path.pm</strong></td><td width="33%" align="right"><a href="././code/Path.html" title="View source code">Code</a>&nbsp;|&nbsp;<a href="./../pdf/Path.pdf" title="PDF US Letter Size">PDF</a>&nbsp;|&nbsp;<a href="./../pdfgreen/Path.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a>&nbsp;|&nbsp;<a href="./../pdfa4/Path.pdf" title="PDF A4 Size">PDFA4</a>&nbsp;|&nbsp;<a href="./../pdfa4green/Path.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
16 </table>
17 </div>
18 <p>
19 </p>
20 <h2>NAME</h2>
21 <p>Path - Path class</p>
22 <p>
23 </p>
24 <h2>SYNOPSIS</h2>
25 <p>use Graph::Path;</p>
26 <p>use Graph::Path qw(:all);</p>
27 <p>
28 </p>
29 <h2>DESCRIPTION</h2>
30 <p><strong>Path</strong> class provides the following methods:</p>
31 <p> <a href="#new">new</a>, <a href="#addvertex">AddVertex</a>, <a href="#addvertices">AddVertices</a>, <a href="#copy">Copy</a>, <a href="#getcommonvertices">GetCommonVertices</a>, <a href="#getedges">GetEdges</a>, <a href="#getendvertex">GetEndVertex</a>
32 , <a href="#getlength">GetLength</a>, <a href="#getstartvertex">GetStartVertex</a>, <a href="#getterminalvertices">GetTerminalVertices</a>, <a href="#getvertex">GetVertex</a>, <a href="#getvertices">GetVertices</a>, <a href="#iscycle">IsCycle</a>
33 , <a href="#isindependentcyclicpath">IsIndependentCyclicPath</a>, <a href="#isindependentpath">IsIndependentPath</a>, <a href="#ispath">IsPath</a>, <a href="#join">Join</a>, <a href="#joinatvertex">JoinAtVertex</a>, <a href="#popvertex">PopVertex</a>
34 , <a href="#pushvertex">PushVertex</a>, <a href="#pushvertices">PushVertices</a>, <a href="#reverse">Reverse</a>, <a href="#shiftvertex">ShiftVertex</a>, <a href="#stringifypath">StringifyPath</a>, <a href="#unshiftvertex">UnshiftVertex</a>
35 , <a href="#unshiftvertices">UnshiftVertices</a>
36 </p><p>Path is a sequential list of vertices with an edge between two successive vertices. The path
37 becomes a cycle when start vertex and end vertex are the same.</p>
38 <p>The following operators are overloaded:</p>
39 <div class="OptionsBox">
40 &quot;&quot; == eq</div>
41 <p>
42 </p>
43 <h2>METHODS</h2>
44 <dl>
45 <dt><strong><a name="new" class="item"><strong>new</strong></a></strong></dt>
46 <dd>
47 <div class="OptionsBox">
48 $NewPath = new Path();
49 <br/> $NewPath = new Path(@VertexIDs);</div>
50 <p>Using specified <em>VertexIDs</em>, <strong>new</strong> method creates a new <strong>Path</strong> object and returns
51 newly created <strong>Path</strong> object.</p>
52 </dd>
53 <dt><strong><a name="addvertex" class="item"><strong>AddVertex</strong></a></strong></dt>
54 <dd>
55 <div class="OptionsBox">
56 $Path-&gt;AddVertex($VertexID);</div>
57 <p>Adds <em>VertexID</em> to <em>Path</em> and returns <em>Path</em>.</p>
58 </dd>
59 <dt><strong><a name="addvertices" class="item"><strong>AddVertices</strong></a></strong></dt>
60 <dd>
61 <div class="OptionsBox">
62 $Path-&gt;AddVertices(@VertexIDs);</div>
63 <p>Adds vertices using <em>VertexIDs</em> to <em>Path</em> and returns <em>Graph</em>.</p>
64 </dd>
65 <dt><strong><a name="copy" class="item"><strong>Copy</strong></a></strong></dt>
66 <dd>
67 <div class="OptionsBox">
68 $Return = $Path-&gt;Copy();</div>
69 <p>Copies <em>Path</em> and its associated data using <strong>Storable::dclone</strong> and returns a new
70 <strong>Path</strong> object.</p>
71 </dd>
72 <dt><strong><a name="getcommonvertices" class="item"><strong>GetCommonVertices</strong></a></strong></dt>
73 <dd>
74 <div class="OptionsBox">
75 @CommonVertices = $Path-&gt;GetCommonVertices($OtherPath);
76 <br/> $NumOfCommonVertices = $Path-&gt;GetCommonVertices($OtherPath);</div>
77 <p>Returns an array containing common vertex IDs between two paths. In scalar context, number
78 of common vertices is returned.</p>
79 </dd>
80 <dt><strong><a name="getedges" class="item"><strong>GetEdges</strong></a></strong></dt>
81 <dd>
82 <div class="OptionsBox">
83 @EdgesVertexIDs = $Path-&gt;GetEdges();
84 <br/> $NumOfEdges = $Path-&gt;GetEdges();</div>
85 <p>Returns an array containg successive paris of vertex IDs corresponding to all edges in <em>Path</em>.
86 In scalar context, the number of edges is returned.</p>
87 </dd>
88 <dt><strong><a name="getendvertex" class="item"><strong>GetEndVertex</strong></a></strong></dt>
89 <dd>
90 <div class="OptionsBox">
91 $VertexID = $Path-&gt;GetEndVertex();</div>
92 <p>Returns <strong>VertexID</strong> of end vertex in <em>Path</em>.</p>
93 </dd>
94 <dt><strong><a name="getlength" class="item"><strong>GetLength</strong></a></strong></dt>
95 <dd>
96 <div class="OptionsBox">
97 $Length = $Path-&gt;GetLength();</div>
98 <p>Returns <strong>Length</strong> of <em>Path</em> corresponding to number of vertices in <em>Path</em>.</p>
99 </dd>
100 <dt><strong><a name="getstartvertex" class="item"><strong>GetStartVertex</strong></a></strong></dt>
101 <dd>
102 <div class="OptionsBox">
103 $VertexID = $Path-&gt;GetStartVertex();</div>
104 <p>Returns <strong>VertexID</strong> of start vertex in <em>Path</em>.</p>
105 </dd>
106 <dt><strong><a name="getterminalvertices" class="item"><strong>GetTerminalVertices</strong></a></strong></dt>
107 <dd>
108 <div class="OptionsBox">
109 ($StartVertexID, $EndVertexID) = $Path-&gt;GetTerminalVertices();</div>
110 <p>Returns vertex IDs of start and end vertices in <em>Path</em>.</p>
111 </dd>
112 <dt><strong><a name="getvertex" class="item"><strong>GetVertex</strong></a></strong></dt>
113 <dd>
114 <div class="OptionsBox">
115 $VertexID = $Path-&gt;GetVertex($Index);</div>
116 <p>Returns specific vertex ID from <em>Path</em> corresponding to <em>Index</em> with indicies starting from 0.</p>
117 </dd>
118 <dt><strong><a name="getvertices" class="item"><strong>GetVertices</strong></a></strong></dt>
119 <dd>
120 <div class="OptionsBox">
121 @Vertices = $Path-&gt;GetVertices();
122 <br/> $NumOfVertices = $Path-&gt;GetVertices();</div>
123 <p>Returns an array containing all vertex IDs in <em>Path</em>. In scalar context, number of vertices
124 is returned.</p>
125 </dd>
126 <dt><strong><a name="iscycle" class="item"><strong>IsCycle</strong></a></strong></dt>
127 <dd>
128 <div class="OptionsBox">
129 $Status = $Path-&gt;IsCycle();</div>
130 <p>Returns 1 or 0 based on whether <em>Path</em> is a <strong>CyclicPath</strong> which has the same start and
131 end vertex IDs.</p>
132 </dd>
133 <dt><strong><a name="isindependentcyclicpath" class="item"><strong>IsIndependentCyclicPath</strong></a></strong></dt>
134 <dd>
135 <div class="OptionsBox">
136 $Status = $Path-&gt;IsIndependentCyclicPath();</div>
137 <p>Returns 1 or 0 based on whether <em>Path</em> is an independent <strong>CyclicPath</strong>. For a <em>Path</em> to be
138 an independent cyclic path, it must be a cyclic path and have unique vertices.</p>
139 </dd>
140 <dt><strong><a name="isindependentpath" class="item"><strong>IsIndependentPath</strong></a></strong></dt>
141 <dd>
142 <div class="OptionsBox">
143 $Status = $Path-&gt;IsIndependentPath();</div>
144 <p>Returns 1 or 0 based on whether <em>Path</em> is an independent <strong>Path</strong>. For a <em>Path</em> to be
145 an independent path, it must have unique vertices.</p>
146 </dd>
147 <dt><strong><a name="ispath" class="item"><strong>IsPath</strong></a></strong></dt>
148 <dd>
149 <div class="OptionsBox">
150 $Status = Graph::Path::IsPath();</div>
151 <p>Returns 1 or 0 based on whether <em>Object</em> is a <strong>Path</strong> object</p>
152 </dd>
153 <dt><strong><a name="join" class="item"><strong>Join</strong></a></strong></dt>
154 <dd>
155 <div class="OptionsBox">
156 $NewPath = $Path-&gt;Join($OtherPath);
157 <br/> $NewPath = $Path-&gt;Join(@VertexIDs);</div>
158 <p>Joins existing <em>Path</em> with a new path specified as a <em>OtherPath</em> object or an array of <em>VertexIDs</em>
159 and returns <em>NewPath</em>.</p>
160 <p>In order to successfully join two paths, terminal vertices must have a common vertex. Based on the
161 common terminal vertex found, additional path vertices are added to the current <em>Path</em> in one of
162 the following four ways:</p>
163 <div class="OptionsBox">
164 . EndVertex = NewStartVertex: New path at end of current path with
165 same vertices order</div>
166 <div class="OptionsBox">
167 . EndVertex = NewEndVertex: New path at end of current path with
168 reversed vertices order</div>
169 <div class="OptionsBox">
170 . StartVertex = NewEndVertex: New path at front of current path
171 with same vertices order</div>
172 <div class="OptionsBox">
173 . StartVertex = NewStartVertex: New path at front of current path
174 with reversed vertices order</div>
175 </dd>
176 <dt><strong><a name="joinatvertex" class="item"><strong>JoinAtVertex</strong></a></strong></dt>
177 <dd>
178 <div class="OptionsBox">
179 $NewPath = $Path-&gt;JoinAtVertex($OtherPath, $CenterVertexID);</div>
180 <p>Joins existing <em>Path</em> with <em>OtherPath</em> at a specified <em>CeterVertexID</em> and returns a <em>NewPath</em>.</p>
181 </dd>
182 <dt><strong><a name="popvertex" class="item"><strong>PopVertex</strong></a></strong></dt>
183 <dd>
184 <div class="OptionsBox">
185 $Path-&gt;PopVertex();</div>
186 <p>Removes end vertex from <em>Path</em> and returns <em>Path</em>.</p>
187 </dd>
188 <dt><strong><a name="pushvertex" class="item"><strong>PushVertex</strong></a></strong></dt>
189 <dd>
190 <div class="OptionsBox">
191 $Path-&gt;PushVertex($VertexID);</div>
192 <p>Adds <em>VertexID</em> to <em>Path</em> after end vertex and returns <em>Path</em>.</p>
193 </dd>
194 <dt><strong><a name="pushvertices" class="item"><strong>PushVertices</strong></a></strong></dt>
195 <dd>
196 <div class="OptionsBox">
197 $Path-&gt;PushVertices(@VertexIDs);</div>
198 <p>Adds <em>VertexIDs</em> to <em>Path</em> after end vertex and returns <em>Path</em>.</p>
199 </dd>
200 <dt><strong><a name="reverse" class="item"><strong>Reverse</strong></a></strong></dt>
201 <dd>
202 <div class="OptionsBox">
203 $Path-&gt;Reverse();</div>
204 <p>Reverses order of vertices in <em>Path</em> and returns <em>Path</em>.</p>
205 </dd>
206 <dt><strong><a name="shiftvertex" class="item"><strong>ShiftVertex</strong></a></strong></dt>
207 <dd>
208 <div class="OptionsBox">
209 $Path-&gt;ShiftVertex();</div>
210 <p>Removes start vertex from <em>Path</em> and returns <em>Path</em>.</p>
211 </dd>
212 <dt><strong><a name="stringifypath" class="item"><strong>StringifyPath</strong></a></strong></dt>
213 <dd>
214 <div class="OptionsBox">
215 $String = $Path-&gt;StringifyPath();</div>
216 <p>Returns a string containing information about <em>Path</em> object.</p>
217 </dd>
218 <dt><strong><a name="unshiftvertex" class="item"><strong>UnshiftVertex</strong></a></strong></dt>
219 <dd>
220 <div class="OptionsBox">
221 $Path-&gt;UnshiftVertex($VertexID);</div>
222 <p>Adds <em>VertexID</em> to <em>Path</em> before start vertex and returns <em>Path</em>.</p>
223 </dd>
224 <dt><strong><a name="unshiftvertices" class="item"><strong>UnshiftVertices</strong></a></strong></dt>
225 <dd>
226 <div class="OptionsBox">
227 $Path-&gt;UnshiftVertices(@VertexIDs);</div>
228 <p>Adds <em>VertexIDs</em> to <em>Path</em> before start vertex and returns <em>Path</em>.</p>
229 </dd>
230 </dl>
231 <p>
232 </p>
233 <h2>AUTHOR</h2>
234 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
235 <p>
236 </p>
237 <h2>SEE ALSO</h2>
238 <p><a href="./PathGraph.html">PathGraph.pm</a>,&nbsp<a href="./PathsTraversal.html">PathsTraversal.pm</a>
239 </p>
240 <p>
241 </p>
242 <h2>COPYRIGHT</h2>
243 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
244 <p>This file is part of MayaChemTools.</p>
245 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
246 the terms of the GNU Lesser General Public License as published by the Free
247 Software Foundation; either version 3 of the License, or (at your option)
248 any later version.</p>
249 <p>&nbsp</p><p>&nbsp</p><div class="DocNav">
250 <table width="100%" border=0 cellpadding=0 cellspacing=2>
251 <tr align="left" valign="top"><td width="33%" align="left"><a href="./GraphMatrix.html" title="GraphMatrix.html">Previous</a>&nbsp;&nbsp;<a href="./index.html" title="Table of Contents">TOC</a>&nbsp;&nbsp;<a href="./PathGraph.html" title="PathGraph.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>Graph::Path.pm</strong></td></tr>
252 </table>
253 </div>
254 <br />
255 <center>
256 <img src="../../images/h2o2.png">
257 </center>
258 </body>
259 </html>