annotate mayachemtool/mayachemtools/docs/modules/txt/GraphMatrix.txt @ 0:68300206e90d draft default tip

Uploaded
author deepakjadmin
date Thu, 05 Nov 2015 02:41:30 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
1 NAME
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
2 GraphMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
3
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
4 SYNOPSIS
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
5 use Graph::GraphMatrix;
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
6
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
7 use Graph::GraphMatrix qw(:all);
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
8
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
9 DESCRIPTION
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
10 GraphMatrix class provides the following methods:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
11
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
12 new, GenerateAdjacencyMatrix, GenerateAdmittanceMatrix,
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
13 GenerateDegreeMatrix, GenerateDistanceMatrix, GenerateIncidenceMatrix,
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
14 GenerateKirchhoffMatrix, GenerateLaplacianMatrix,
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
15 GenerateNormalizedLaplacianMatrix, GenerateSiedelAdjacencyMatrix,
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
16 GetColumnIDs, GetMatrix, GetMatrixType, GetRowIDs, StringifyGraphMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
17
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
18 METHODS
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
19 new
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
20 $NewGraphMatrix = new Graph::GraphMatrix($Graph);
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
21
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
22 Using specified *Graph*, new method creates a new GraphMatrix and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
23 returns newly created GraphMatrix.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
24
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
25 GenerateAdjacencyMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
26 $AdjacencyGraphMatrix = $GraphMatrix->GenerateAdjacencyMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
27
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
28 Generates a new *AdjacencyGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
29 returns *AdjacencyGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
30
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
31 For a simple graph G with n vertices, the adjacency matrix for G is
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
32 a n x n square matrix and its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
33
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
34 . 0 if i == j
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
35 . 1 if i != j and vertex Vi is adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
36 . 0 if i != j and vertex Vi is not adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
37
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
38 GenerateAdmittanceMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
39 $AdmittanceGraphMatrix = $GraphMatrix->GenerateAdmittanceMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
40
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
41 Generates a new *AdmittanceGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
42 returns *AdmittanceGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
43
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
44 AdmittanceMatrix is another name for LaplacianMatrix.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
45
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
46 GenerateDegreeMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
47 $DegreeGraphMatrix = $GraphMatrix->GenerateDegreeMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
48
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
49 Generates a new *DegreeGraphMatrix* for specified Graph and returns
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
50 *DegreeGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
51
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
52 For a simple graph G with n vertices, the degree matrix for G is a n
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
53 x n square matrix and its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
54
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
55 . deg(Vi) if i == j and deg(Vi) is the degree of vertex Vi
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
56 . 0 otherwise
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
57
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
58 GenerateDistanceMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
59 $DistanceGraphMatrix = $GraphMatrix->GenerateDistanceMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
60
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
61 Generates a new *DistanceGraphMatrix* for specified Graph using
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
62 Floyd-Marshall algorithm [Ref 67] and returns *DistanceGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
63
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
64 For a simple graph G with n vertices, the distance matrix for G is a
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
65 n x n square matrix and its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
66
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
67 . 0 if i == j
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
68 . d if i != j and d is the shortest distance between vertex Vi and vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
69
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
70 In the final matrix, value of constant BigNumber defined in
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
71 Constants.pm module corresponds to vertices with no edges.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
72
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
73 GenerateIncidenceMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
74 $IncidenceGraphMatrix = $GraphMatrix->GenerateIncidenceMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
75
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
76 Generates a new *IncidenceGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
77 returns *IncidenceGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
78
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
79 For a simple graph G with n vertices and e edges, the incidence
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
80 matrix for G is a n x e matrix its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
81
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
82 . 1 if vertex Vi and the edge Ej are incident; in other words, Vi and Ej are related
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
83 . 0 otherwise
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
84
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
85 GenerateKirchhoffMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
86 $KirchhoffGraphMatrix = $GraphMatrix->GenerateKirchhoffMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
87
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
88 Generates a new *KirchhoffGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
89 returns *KirchhoffGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
90
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
91 KirchhoffMatrix is another name for LaplacianMatrix.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
92
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
93 GenerateLaplacianMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
94 $LaplacianGraphMatrix = $GraphMatrix->GenerateLaplacianMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
95
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
96 Generates a new *LaplacianGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
97 returns *LaplacianGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
98
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
99 For a simple graph G with n vertices, the Laplacian matrix for G is
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
100 a n x n square matrix and its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
101
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
102 . deg(Vi) if i == j and deg(Vi) is the degree of vertex Vi
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
103 . -1 if i != j and vertex Vi is adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
104 . 0 otherwise
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
105
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
106 The Laplacian matrix is the difference between the degree matrix and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
107 adjacency matrix.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
108
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
109 GenerateNormalizedLaplacianMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
110 $NormalizedLaplacianGraphMatrix = $GraphMatrix->GenerateNormalizedLaplacianMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
111
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
112 Generates a new *NormalizedLaplacianGraphMatrix* for specified Graph
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
113 and returns *NormalizedLaplacianGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
114
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
115 For a simple graph G with n vertices, the normalized Laplacian
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
116 matrix L for G is a n x n square matrix and its elements Lij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
117
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
118 . 1 if i == j and deg(Vi) != 0
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
119 . -1/SQRT(deg(Vi) * deg(Vj)) if i != j and vertex Vi is adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
120 . 0 otherwise
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
121
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
122 GenerateSiedelAdjacencyMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
123 $SiedelAdjacencyGraphMatrix = $GraphMatrix->GenerateSiedelAdjacencyMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
124
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
125 Generates a new *SiedelAdjacencyGraphMatrix* for specified Graph and
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
126 returns *SiedelAdjacencyGraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
127
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
128 For a simple graph G with n vertices, the Siedal adjacency matrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
129 for G is a n x n square matrix and its elements Mij are:
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
130
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
131 . 0 if i == j
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
132 . -1 if i != j and vertex Vi is adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
133 . 1 if i != j and vertex Vi is not adjacent to vertex Vj
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
134
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
135 GetColumnIDs
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
136 @ColumnIDs = $GraphMatrix->GetColumnIDs();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
137
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
138 Returns an array containing any specified column IDs for
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
139 *GraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
140
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
141 GetMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
142 $Matrix = $GraphMatrix->GetMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
143
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
144 Returns *Matrix* object corresponding to *GraphMatrix* object.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
145
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
146 GetMatrixType
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
147 $MatrixType = $GraphMatrix->GetMatrixType();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
148
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
149 Returns MatrixType of *GraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
150
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
151 GetRowIDs
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
152 @RowIDs = $GraphMatrix->GetRowIDs();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
153
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
154 Returns an array containing any specified rowIDs IDs for
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
155 *GraphMatrix*.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
156
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
157 StringifyGraphMatrix
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
158 $String = $GraphMatrix->StringifyGraphMatrix();
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
159
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
160 Returns a string containing information about *GraphMatrix* object.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
161
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
162 AUTHOR
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
163 Manish Sud <msud@san.rr.com>
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
164
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
165 SEE ALSO
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
166 Constants.pm, Graph.pm, Matrix.pm
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
167
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
168 COPYRIGHT
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
169 Copyright (C) 2015 Manish Sud. All rights reserved.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
170
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
171 This file is part of MayaChemTools.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
172
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
173 MayaChemTools is free software; you can redistribute it and/or modify it
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
174 under the terms of the GNU Lesser General Public License as published by
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
175 the Free Software Foundation; either version 3 of the License, or (at
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
176 your option) any later version.
68300206e90d Uploaded
deepakjadmin
parents:
diff changeset
177