| 
0
 | 
     1 <html>
 | 
| 
 | 
     2 <head>
 | 
| 
 | 
     3 <title>MayaChemTools:Documentation:Graph::GraphMatrix.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="./CyclesDetection.html" title="CyclesDetection.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./Path.html" title="Path.html">Next</a></td><td width="34%" align="middle"><strong>Graph::GraphMatrix.pm</strong></td><td width="33%" align="right"><a href="././code/GraphMatrix.html" title="View source code">Code</a> | <a href="./../pdf/GraphMatrix.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/GraphMatrix.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/GraphMatrix.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/GraphMatrix.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>GraphMatrix</p>
 | 
| 
 | 
    22 <p>
 | 
| 
 | 
    23 </p>
 | 
| 
 | 
    24 <h2>SYNOPSIS</h2>
 | 
| 
 | 
    25 <p>use Graph::GraphMatrix;</p>
 | 
| 
 | 
    26 <p>use Graph::GraphMatrix qw(:all);</p>
 | 
| 
 | 
    27 <p>
 | 
| 
 | 
    28 </p>
 | 
| 
 | 
    29 <h2>DESCRIPTION</h2>
 | 
| 
 | 
    30 <p><strong>GraphMatrix</strong> class provides the following methods:</p>
 | 
| 
 | 
    31 <p> <a href="#new">new</a>, <a href="#generateadjacencymatrix">GenerateAdjacencyMatrix</a>, <a href="#generateadmittancematrix">GenerateAdmittanceMatrix</a>, <a href="#generatedegreematrix">GenerateDegreeMatrix</a>
 | 
| 
 | 
    32 , <a href="#generatedistancematrix">GenerateDistanceMatrix</a>, <a href="#generateincidencematrix">GenerateIncidenceMatrix</a>, <a href="#generatekirchhoffmatrix">GenerateKirchhoffMatrix</a>
 | 
| 
 | 
    33 , <a href="#generatelaplacianmatrix">GenerateLaplacianMatrix</a>, <a href="#generatenormalizedlaplacianmatrix">GenerateNormalizedLaplacianMatrix</a>
 | 
| 
 | 
    34 , <a href="#generatesiedeladjacencymatrix">GenerateSiedelAdjacencyMatrix</a>, <a href="#getcolumnids">GetColumnIDs</a>, <a href="#getmatrix">GetMatrix</a>, <a href="#getmatrixtype">GetMatrixType</a>, <a href="#getrowids">GetRowIDs</a>
 | 
| 
 | 
    35 , <a href="#stringifygraphmatrix">StringifyGraphMatrix</a>
 | 
| 
 | 
    36 </p><p>
 | 
| 
 | 
    37 </p>
 | 
| 
 | 
    38 <h2>METHODS</h2>
 | 
| 
 | 
    39 <dl>
 | 
| 
 | 
    40 <dt><strong><a name="new" class="item"><strong>new</strong></a></strong></dt>
 | 
| 
 | 
    41 <dd>
 | 
| 
 | 
    42 <div class="OptionsBox">
 | 
| 
 | 
    43     $NewGraphMatrix = new Graph::GraphMatrix($Graph);</div>
 | 
| 
 | 
    44 <p>Using specified <em>Graph</em>, <strong>new</strong> method creates a new <strong>GraphMatrix</strong> and returns
 | 
| 
 | 
    45 newly created <strong>GraphMatrix</strong>.</p>
 | 
| 
 | 
    46 </dd>
 | 
| 
 | 
    47 <dt><strong><a name="generateadjacencymatrix" class="item"><strong>GenerateAdjacencyMatrix</strong></a></strong></dt>
 | 
| 
 | 
    48 <dd>
 | 
| 
 | 
    49 <div class="OptionsBox">
 | 
| 
 | 
    50     $AdjacencyGraphMatrix = $GraphMatrix->GenerateAdjacencyMatrix();</div>
 | 
| 
 | 
    51 <p>Generates a new <em>AdjacencyGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
    52 <em>AdjacencyGraphMatrix</em>.</p>
 | 
| 
 | 
    53 <p>For a simple graph G with n vertices, the adjacency matrix for G is a n x n square matrix and
 | 
| 
 | 
    54 its elements Mij are:</p>
 | 
| 
 | 
    55 <div class="OptionsBox">
 | 
| 
 | 
    56     . 0    if i == j
 | 
| 
 | 
    57 <br/>    . 1    if i != j and vertex Vi is adjacent to vertex Vj
 | 
| 
 | 
    58 <br/>    . 0    if i != j and vertex Vi is not adjacent to vertex Vj</div>
 | 
| 
 | 
    59 </dd>
 | 
| 
 | 
    60 <dt><strong><a name="generateadmittancematrix" class="item"><strong>GenerateAdmittanceMatrix</strong></a></strong></dt>
 | 
| 
 | 
    61 <dd>
 | 
| 
 | 
    62 <div class="OptionsBox">
 | 
| 
 | 
    63     $AdmittanceGraphMatrix = $GraphMatrix->GenerateAdmittanceMatrix();</div>
 | 
| 
 | 
    64 <p>Generates a new <em>AdmittanceGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
    65 <em>AdmittanceGraphMatrix</em>.</p>
 | 
| 
 | 
    66 <p><strong>AdmittanceMatrix</strong> is another name for <strong>LaplacianMatrix</strong>.</p>
 | 
| 
 | 
    67 </dd>
 | 
| 
 | 
    68 <dt><strong><a name="generatedegreematrix" class="item"><strong>GenerateDegreeMatrix</strong></a></strong></dt>
 | 
| 
 | 
    69 <dd>
 | 
| 
 | 
    70 <div class="OptionsBox">
 | 
| 
 | 
    71     $DegreeGraphMatrix = $GraphMatrix->GenerateDegreeMatrix();</div>
 | 
| 
 | 
    72 <p>Generates a new <em>DegreeGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
    73 <em>DegreeGraphMatrix</em>.</p>
 | 
| 
 | 
    74 <p>For a simple graph G with n vertices, the degree matrix for G is a n x n square matrix and
 | 
| 
 | 
    75 its elements Mij are:</p>
 | 
| 
 | 
    76 <div class="OptionsBox">
 | 
| 
 | 
    77     . deg(Vi)   if i == j and deg(Vi) is the degree of vertex Vi
 | 
| 
 | 
    78 <br/>    . 0         otherwise</div>
 | 
| 
 | 
    79 </dd>
 | 
| 
 | 
    80 <dt><strong><a name="generatedistancematrix" class="item"><strong>GenerateDistanceMatrix</strong></a></strong></dt>
 | 
| 
 | 
    81 <dd>
 | 
| 
 | 
    82 <div class="OptionsBox">
 | 
| 
 | 
    83     $DistanceGraphMatrix = $GraphMatrix->GenerateDistanceMatrix();</div>
 | 
| 
 | 
    84 <p>Generates a new <em>DistanceGraphMatrix</em> for specified <strong>Graph</strong> using Floyd-Marshall
 | 
| 
 | 
    85 algorithm [Ref 67] and returns <em>DistanceGraphMatrix</em>.</p>
 | 
| 
 | 
    86 <p>For a simple graph G with n vertices, the distance matrix for G is a n x n square matrix and
 | 
| 
 | 
    87 its elements Mij are:</p>
 | 
| 
 | 
    88 <div class="OptionsBox">
 | 
| 
 | 
    89     . 0    if i == j
 | 
| 
 | 
    90 <br/>    . d    if i != j and d is the shortest distance between vertex Vi and vertex Vj</div>
 | 
| 
 | 
    91 <p>In the final matrix, value of constant <strong>BigNumber</strong> defined in <strong>Constants.pm</strong> module
 | 
| 
 | 
    92 corresponds to vertices with no edges.</p>
 | 
| 
 | 
    93 </dd>
 | 
| 
 | 
    94 <dt><strong><a name="generateincidencematrix" class="item"><strong>GenerateIncidenceMatrix</strong></a></strong></dt>
 | 
| 
 | 
    95 <dd>
 | 
| 
 | 
    96 <div class="OptionsBox">
 | 
| 
 | 
    97     $IncidenceGraphMatrix = $GraphMatrix->GenerateIncidenceMatrix();</div>
 | 
| 
 | 
    98 <p>Generates a new <em>IncidenceGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
    99 <em>IncidenceGraphMatrix</em>.</p>
 | 
| 
 | 
   100 <p>For a simple graph G with n vertices and e edges, the incidence matrix for G is a n x e matrix
 | 
| 
 | 
   101 its elements Mij are:</p>
 | 
| 
 | 
   102 <div class="OptionsBox">
 | 
| 
 | 
   103     . 1    if vertex Vi and the edge Ej are incident; in other words, Vi and Ej are related
 | 
| 
 | 
   104 <br/>    . 0    otherwise</div>
 | 
| 
 | 
   105 </dd>
 | 
| 
 | 
   106 <dt><strong><a name="generatekirchhoffmatrix" class="item"><strong>GenerateKirchhoffMatrix</strong></a></strong></dt>
 | 
| 
 | 
   107 <dd>
 | 
| 
 | 
   108 <div class="OptionsBox">
 | 
| 
 | 
   109     $KirchhoffGraphMatrix = $GraphMatrix->GenerateKirchhoffMatrix();</div>
 | 
| 
 | 
   110 <p>Generates a new <em>KirchhoffGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
   111 <em>KirchhoffGraphMatrix</em>.</p>
 | 
| 
 | 
   112 <p><strong>KirchhoffMatrix</strong> is another name for <strong>LaplacianMatrix</strong>.</p>
 | 
| 
 | 
   113 </dd>
 | 
| 
 | 
   114 <dt><strong><a name="generatelaplacianmatrix" class="item"><strong>GenerateLaplacianMatrix</strong></a></strong></dt>
 | 
| 
 | 
   115 <dd>
 | 
| 
 | 
   116 <div class="OptionsBox">
 | 
| 
 | 
   117     $LaplacianGraphMatrix = $GraphMatrix->GenerateLaplacianMatrix();</div>
 | 
| 
 | 
   118 <p>Generates a new <em>LaplacianGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
   119 <em>LaplacianGraphMatrix</em>.</p>
 | 
| 
 | 
   120 <p>For a simple graph G with n vertices, the Laplacian matrix for G is a n x n square matrix and
 | 
| 
 | 
   121 its elements Mij are:</p>
 | 
| 
 | 
   122 <div class="OptionsBox">
 | 
| 
 | 
   123     . deg(Vi)   if i == j and deg(Vi) is the degree of vertex Vi
 | 
| 
 | 
   124 <br/>    . -1        if i != j and vertex Vi is adjacent to vertex Vj
 | 
| 
 | 
   125 <br/>    . 0         otherwise</div>
 | 
| 
 | 
   126 <p>The Laplacian matrix is the difference between the degree matrix and adjacency matrix.</p>
 | 
| 
 | 
   127 </dd>
 | 
| 
 | 
   128 <dt><strong><a name="generatenormalizedlaplacianmatrix" class="item"><strong>GenerateNormalizedLaplacianMatrix</strong></a></strong></dt>
 | 
| 
 | 
   129 <dd>
 | 
| 
 | 
   130 <div class="OptionsBox">
 | 
| 
 | 
   131     $NormalizedLaplacianGraphMatrix = $GraphMatrix->GenerateNormalizedLaplacianMatrix();</div>
 | 
| 
 | 
   132 <p>Generates a new <em>NormalizedLaplacianGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
   133 <em>NormalizedLaplacianGraphMatrix</em>.</p>
 | 
| 
 | 
   134 <p>For a simple graph G with n vertices, the normalized Laplacian matrix L for G is a n x n square
 | 
| 
 | 
   135 matrix and its elements Lij are:</p>
 | 
| 
 | 
   136 <div class="OptionsBox">
 | 
| 
 | 
   137     .  1                           if i == j and deg(Vi) != 0
 | 
| 
 | 
   138 <br/>    .  -1/SQRT(deg(Vi) * deg(Vj))  if i != j and vertex Vi is adjacent to vertex Vj
 | 
| 
 | 
   139 <br/>    .  0                           otherwise</div>
 | 
| 
 | 
   140 </dd>
 | 
| 
 | 
   141 <dt><strong><a name="generatesiedeladjacencymatrix" class="item"><strong>GenerateSiedelAdjacencyMatrix</strong></a></strong></dt>
 | 
| 
 | 
   142 <dd>
 | 
| 
 | 
   143 <div class="OptionsBox">
 | 
| 
 | 
   144     $SiedelAdjacencyGraphMatrix = $GraphMatrix->GenerateSiedelAdjacencyMatrix();</div>
 | 
| 
 | 
   145 <p>Generates a new <em>SiedelAdjacencyGraphMatrix</em> for specified <strong>Graph</strong> and returns
 | 
| 
 | 
   146 <em>SiedelAdjacencyGraphMatrix</em>.</p>
 | 
| 
 | 
   147 <p>For a simple graph G with n vertices, the Siedal adjacency matrix for G is a n x n square matrix and
 | 
| 
 | 
   148 its elements Mij are:</p>
 | 
| 
 | 
   149 <div class="OptionsBox">
 | 
| 
 | 
   150     . 0    if i == j
 | 
| 
 | 
   151 <br/>    . -1   if i != j and vertex Vi is adjacent to vertex Vj
 | 
| 
 | 
   152 <br/>    . 1    if i != j and vertex Vi is not adjacent to vertex Vj</div>
 | 
| 
 | 
   153 </dd>
 | 
| 
 | 
   154 <dt><strong><a name="getcolumnids" class="item"><strong>GetColumnIDs</strong></a></strong></dt>
 | 
| 
 | 
   155 <dd>
 | 
| 
 | 
   156 <div class="OptionsBox">
 | 
| 
 | 
   157     @ColumnIDs = $GraphMatrix->GetColumnIDs();</div>
 | 
| 
 | 
   158 <p>Returns an array containing any specified column IDs for <em>GraphMatrix</em>.</p>
 | 
| 
 | 
   159 </dd>
 | 
| 
 | 
   160 <dt><strong><a name="getmatrix" class="item"><strong>GetMatrix</strong></a></strong></dt>
 | 
| 
 | 
   161 <dd>
 | 
| 
 | 
   162 <div class="OptionsBox">
 | 
| 
 | 
   163     $Matrix = $GraphMatrix->GetMatrix();</div>
 | 
| 
 | 
   164 <p>Returns <em>Matrix</em> object corresponding to <em>GraphMatrix</em> object.</p>
 | 
| 
 | 
   165 </dd>
 | 
| 
 | 
   166 <dt><strong><a name="getmatrixtype" class="item"><strong>GetMatrixType</strong></a></strong></dt>
 | 
| 
 | 
   167 <dd>
 | 
| 
 | 
   168 <div class="OptionsBox">
 | 
| 
 | 
   169     $MatrixType = $GraphMatrix->GetMatrixType();</div>
 | 
| 
 | 
   170 <p>Returns <strong>MatrixType</strong> of <em>GraphMatrix</em>.</p>
 | 
| 
 | 
   171 </dd>
 | 
| 
 | 
   172 <dt><strong><a name="getrowids" class="item"><strong>GetRowIDs</strong></a></strong></dt>
 | 
| 
 | 
   173 <dd>
 | 
| 
 | 
   174 <div class="OptionsBox">
 | 
| 
 | 
   175     @RowIDs = $GraphMatrix->GetRowIDs();</div>
 | 
| 
 | 
   176 <p>Returns an array containing any specified rowIDs IDs for <em>GraphMatrix</em>.</p>
 | 
| 
 | 
   177 </dd>
 | 
| 
 | 
   178 <dt><strong><a name="stringifygraphmatrix" class="item"><strong>StringifyGraphMatrix</strong></a></strong></dt>
 | 
| 
 | 
   179 <dd>
 | 
| 
 | 
   180 <div class="OptionsBox">
 | 
| 
 | 
   181     $String = $GraphMatrix->StringifyGraphMatrix();</div>
 | 
| 
 | 
   182 <p>Returns a string containing information about <em>GraphMatrix</em> object.</p>
 | 
| 
 | 
   183 </dd>
 | 
| 
 | 
   184 </dl>
 | 
| 
 | 
   185 <p>
 | 
| 
 | 
   186 </p>
 | 
| 
 | 
   187 <h2>AUTHOR</h2>
 | 
| 
 | 
   188 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
 | 
| 
 | 
   189 <p>
 | 
| 
 | 
   190 </p>
 | 
| 
 | 
   191 <h2>SEE ALSO</h2>
 | 
| 
 | 
   192 <p><a href="./Constants.html">Constants.pm</a>, <a href="./Graph.html">Graph.pm</a>, <a href="./Matrix.html">Matrix.pm</a>
 | 
| 
 | 
   193 </p>
 | 
| 
 | 
   194 <p>
 | 
| 
 | 
   195 </p>
 | 
| 
 | 
   196 <h2>COPYRIGHT</h2>
 | 
| 
 | 
   197 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
 | 
| 
 | 
   198 <p>This file is part of MayaChemTools.</p>
 | 
| 
 | 
   199 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
 | 
| 
 | 
   200 the terms of the GNU Lesser General Public License as published by the Free
 | 
| 
 | 
   201 Software Foundation; either version 3 of the License, or (at your option)
 | 
| 
 | 
   202 any later version.</p>
 | 
| 
 | 
   203 <p> </p><p> </p><div class="DocNav">
 | 
| 
 | 
   204 <table width="100%" border=0 cellpadding=0 cellspacing=2>
 | 
| 
 | 
   205 <tr align="left" valign="top"><td width="33%" align="left"><a href="./CyclesDetection.html" title="CyclesDetection.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./Path.html" title="Path.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>Graph::GraphMatrix.pm</strong></td></tr>
 | 
| 
 | 
   206 </table>
 | 
| 
 | 
   207 </div>
 | 
| 
 | 
   208 <br />
 | 
| 
 | 
   209 <center>
 | 
| 
 | 
   210 <img src="../../images/h2o2.png">
 | 
| 
 | 
   211 </center>
 | 
| 
 | 
   212 </body>
 | 
| 
 | 
   213 </html>
 |