Graph
use Graph;
use Graph qw(:all);
Graph class provides the following methods:
new, AddCycle, AddEdge, AddEdges, AddPath, AddVertex, AddVertices, ClearCycles, Copy, CopyEdgesProperties, CopyVerticesAndEdges, CopyVerticesProperties, DeleteCycle, DeleteEdge, DeleteEdgeProperties, DeleteEdgeProperty, DeleteEdges, DeleteEdgesProperties, DeleteEdgesProperty, DeleteGraphProperties, DeleteGraphProperty, DeletePath, DeleteVertex, DeleteVertexProperties, DeleteVertexProperty, DeleteVertices, DeleteVerticesProperty, DetectCycles, GetAdjacencyMatrix, GetAdmittanceMatrix, GetAllPaths, GetAllPathsStartingAt, GetAllPathsStartingAtWithLength, GetAllPathsStartingAtWithLengthUpto, GetAllPathsWithLength, GetAllPathsWithLengthUpto, GetCircumference, GetConnectedComponentsVertices, GetCycles, GetCyclesWithEvenSize, GetCyclesWithOddSize, GetCyclesWithSize, GetCyclesWithSizeGreaterThan, GetCyclesWithSizeLessThan, GetDegree, GetDegreeMatrix, GetDistanceMatrix, GetEdgeCycles, GetEdgeCyclesWithEvenSize, GetEdgeCyclesWithOddSize, GetEdgeCyclesWithSize, GetEdgeCyclesWithSizeGreaterThan, GetEdgeCyclesWithSizeLessThan, GetEdgeProperties, GetEdgeProperty, GetEdges, GetEdgesProperty, GetFusedAndNonFusedCycles, GetGirth, GetGraphProperties, GetGraphProperty, GetIncidenceMatrix, GetIsolatedVertices, GetKirchhoffMatrix, GetLaplacianMatrix, GetLargestCycle, GetLargestEdgeCycle, GetLargestVertexCycle, GetLeafVertices, GetMaximumDegree, GetMininumDegree, GetNeighborhoodVertices, GetNeighborhoodVerticesWithRadiusUpto, GetNeighborhoodVerticesWithSuccessors, GetNeighborhoodVerticesWithSuccessorsAndRadiusUpto, GetNeighbors, GetNormalizedLaplacianMatrix, GetNumOfCycles, GetNumOfCyclesWithEvenSize, GetNumOfCyclesWithOddSize, GetNumOfCyclesWithSize, GetNumOfCyclesWithSizeGreaterThan, GetNumOfCyclesWithSizeLessThan, GetNumOfEdgeCycles, GetNumOfEdgeCyclesWithEvenSize, GetNumOfEdgeCyclesWithOddSize, GetNumOfEdgeCyclesWithSize, GetNumOfEdgeCyclesWithSizeGreaterThan, GetNumOfEdgeCyclesWithSizeLessThan, GetNumOfVertexCycles, GetNumOfVertexCyclesWithEvenSize, GetNumOfVertexCyclesWithOddSize, GetNumOfVertexCyclesWithSize, GetNumOfVertexCyclesWithSizeGreaterThan, GetNumOfVertexCyclesWithSizeLessThan, GetPaths, GetPathsBetween, GetPathsStartingAt, GetPathsStartingAtWithLength, GetPathsStartingAtWithLengthUpto, GetPathsWithLength, GetPathsWithLengthUpto, GetSiedelAdjacencyMatrix, GetSizeOfLargestCycle, GetSizeOfLargestEdgeCycle, GetSizeOfLargestVertexCycle, GetSizeOfSmallestCycle, GetSizeOfSmallestEdgeCycle, GetSizeOfSmallestVertexCycle, GetSmallestCycle, GetSmallestEdgeCycle, GetSmallestVertexCycle, GetTopologicallySortedVertices, GetVertex, GetVertexCycles, GetVertexCyclesWithEvenSize, GetVertexCyclesWithOddSize, GetVertexCyclesWithSize, GetVertexCyclesWithSizeGreaterThan, GetVertexCyclesWithSizeLessThan, GetVertexProperties, GetVertexProperty, GetVertexWithLargestDegree, GetVertexWithSmallestDegree, GetVertices, GetVerticesProperty, GetVerticesWithDegreeLessThan, HasCycle, HasEdge, HasEdgeProperty, HasEdges, HasFusedCycles, HasGraphProperty, HasPath, HasVertex, HasVertexProperty, HasVertices, IsAcyclic, IsAcyclicEdge, IsAcyclicVertex, IsCyclic, IsCyclicEdge, IsCyclicVertex, IsGraph, IsIsolatedVertex, IsLeafVertex, IsUnicyclic, IsUnicyclicEdge, IsUnicyclicVertex, SetActiveCyclicPaths, SetEdgeProperties, SetEdgeProperty, SetEdgesProperty, SetGraphProperties, SetGraphProperty, SetVertexProperties, SetVertexProperty, SetVerticesProperty, StringifyEdgesProperties, StringifyGraph, StringifyGraphProperties, StringifyProperties, StringifyVerticesAndEdges, StringifyVerticesProperties, UpdateEdgeProperty, UpdateVertexProperty
Using specified Graph VertexIDs, new method creates a new Graph object and returns newly created Graph object.
Examples:
Adds edges between successive pair of VertexIDs including an additional edge from the last to first vertex ID to complete the cycle to Graph and returns Graph.
Adds an edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Adds edges between successive pair of VertexIDs in a Graph and returns Graph.
Adds edges between successive pair of VertexIDs in a Graph and returns Graph.
Adds VertexID to Graph and returns Graph.
Adds vertices using VertexIDs to Graph and returns Graph.
Delete all cycle properties assigned to graph, vertices, and edges by DetectCycles method.
Copies Graph and its associated data using Storable::dclone and returns a new Graph object.
Copies all properties associated with edges from Graph to $OtherGraph and returns OtherGraph.
Copies all vertices and edges from Graph to $OtherGraph and returns OtherGraph.
Copies all properties associated with vertices from Graph to $OtherGraph and returns OtherGraph.
Deletes edges between successive pair of VertexIDs including an additional edge from the last to first vertex ID to complete the cycle to Graph and returns Graph.
Deletes an edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Deletes all properties associated with edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Deletes PropertyName associated with edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Deletes edges between successive pair of VertexIDs and returns Graph.
Deletes all properties associated with edges between successive pair of VertexIDs and returns Graph.
Deletes PropertyName associated with edges between successive pair of VertexIDs and returns Graph.
Deletes all properties associated as graph not including properties associated to vertices or edges and returns Graph.
Deletes a PropertyName associated as graph property and returns Graph.
Deletes edges between successive pair of VertexIDs in a Graph and returns Graph.
Deletes VertexID to Graph and returns Graph.
Deletes all properties associated with VertexID and returns Graph.
Deletes a PropertyName associated with VertexID and returns Graph.
Deletes vertices specified in VertexIDs and returns Graph.
Deletes a PropertyName associated with VertexIDs and returns Graph.
Detect cycles using CyclesDetection class and associate found cycles to Graph object as graph properties: ActiveCyclicPaths, AllCyclicPaths, IndependentCyclicPaths.
Notes:
Returns adjacency matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the adjacency matrix for G is a n x n square matrix and its elements Mij are:
Returns admittance matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the adjacency matrix for G is a n x n square matrix and its elements Mij are:
Returns a reference to an array containing Path objects corresponding to all possible lengths starting from each vertex in graph with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle. Duplicate paths are not removed.
Returns an array of Path objects starting from a StartVertexID of any length with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects starting from a StartVertexID of specified Length with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects starting from a StartVertexID with length upto a Length with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns a reference to an array containing Path objects corresponding to paths with Length starting from each vertex in graph with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle. Duplicate paths are not removed.
Returns a reference to an array containing Path objects corresponding to paths up to specified Length starting from each vertex in graph with sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle. Duplicate paths are not removed.
Returns size of largest cycle in a Graph
Returns an array ConnectedComponents containing referecens to arrays with vertex IDs for each component sorted in order of their decreasing size.
Returns an array CyclicPaths containing Path objects corresponding to cycles in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with even size in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with odd size in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with CycleSize in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size greater than CycleSize in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size less than CycleSize in a Graph.
Returns Degree for VertexID in a Graph corresponding to sum of in and out vertex degree values.
Returns degree matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the degree matrix for G is a n x n square matrix and its elements Mij are:
Returns distance matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the distance matrix for G is a n x n square matrix and its elements Mij are:
In the final matrix, value of constant BigNumber defined in Constants.pm module corresponds to vertices with no edges.
Returns an array CyclicPaths containing Path objects corresponding to all cycles containing edge between VertexID1 and VertexID2 in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with even size containing edge between VertexID1 and VertexID2 in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with odd size containing edge between VertexID1 and VertexID2 in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size CycleSize containing edge between VertexID1 and VertexID2 in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size greater than CycleSize containing edge between VertexID1 and VertexID2 in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size less than CycleSize containing edge between VertexID1 and VertexID2.
Returns a hash EdgeProperties containing all PropertyName and PropertyValue pairs associated with an edge between VertexID1 and VertexID2 in a Graph.
Returns value of PropertyName associated with an edge between VertexID1 and VertexID2 in a Graph.
Returns an array EdgeVertexIDs with successive pair of IDs corresponding to edges involving VertexID or number of edges for VertexID in a Graph.
Returns an array PropertyValues containing property values corresponding to PropertyName associated with edges between successive pair of VertexIDs.
Returns references to arrays FusedCycleSetsRef and NonFusedCyclesRef containing references to arrays of cyclic Path objects corresponding to fuses and non-fused cyclic paths.
Returns size of smallest cycle in a Graph.
Returns a hash EdgeProperties containing all PropertyName and PropertyValue pairs associated with graph in a Graph.
Returns value of PropertyName associated with graph in a Graph.
Returns incidence matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices and e edges, the incidence matrix for G is a n x e matrix its elements Mij are:
Returns an array VertexIDs containing vertices without any edges in Graph.
Returns Kirchhoff matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
KirchhoffMatrix is another name for LaplacianMatrix.
Returns Laplacian matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the Laplacian matrix for G is a n x n square matrix and its elements Mij are:
Returns a cyclic Path object corresponding to largest cycle in a Graph.
Returns a cyclic Path object corresponding to largest cycle containing edge between VertexID1 and VertexID2 in a Graph.
Returns a cyclic Path object corresponding to largest cycle containing VertexID in a Graph.
Returns an array VertexIDs containing vertices with degree of 1 in a Graph.
Returns value of maximum vertex degree in a Graph.
Returns value of minimum vertex degree in a Graph.
Returns an array VertexNeighborhoods containing references to arrays corresponding to neighborhood vertices around a specified StartVertexID at all possible radii levels.
Returns an array VertexNeighborhoods containing references to arrays corresponding to neighborhood vertices around a specified StartVertexID upto specified Radius levels.
Returns vertex neighborhoods around a specified StartVertexID, along with their successor connected vertices, collected at all neighborhood radii as an array VertexNeighborhoods containing references to arrays with first value corresponding to vertex ID and second value as reference to an array containing its successor connected vertices.
For a neighborhood vertex at each radius level, the successor connected vertices correspond to the neighborhood vertices at the next radius level. Consequently, the neighborhood vertices at the last radius level don't contain any successor vertices which fall outside the range of specified radius.
Returns vertex neighborhoods around a specified StartVertexID, along with their successor connected vertices, collected with in a specified Radius as an array VertexNeighborhoods containing references to arrays with first value corresponding to vertex ID and second value as reference to a list containing its successor connected vertices.
For a neighborhood vertex at each radius level, the successor connected vertices correspond to the neighborhood vertices at the next radius level. Consequently, the neighborhood vertices at the last radius level don't contain any successor vertices which fall outside the range of specified radius.
Returns an array VertexIDs containing vertices connected to VertexID of number of neighbors of a VertextID in a Graph.
Returns normalized Laplacian matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the normalized Laplacian matrix L for G is a n x n square matrix and its elements Lij are:
Returns number of cycles in a Graph.
Returns number of cycles with even size in a Graph.
Returns number of cycles with odd size in a Graph.
Returns number of cycles with CyclesSize in a Graph.
Returns number of cycles with size greater than CyclesSize in a Graph.
Returns number of cycles with size less than CyclesSize in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 with even size in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 with odd size in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 with CycleSize size in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 with size greater than CycleSize size in a Graph.
Returns number of cycles containing edge between VertexID1 and VertexID2 with size less than CycleSize size in a Graph.
Returns number of cycles containing VertexID in a Graph.
Returns number of cycles containing VertexID with even size in a Graph.
Returns number of cycles containing VertexID with odd size in a Graph.
Returns number of cycles containing VertexID with even size in a Graph.
Returns number of cycles containing VertexID with size greater than CycleSize in a Graph.
Returns number of cycles containing VertexID with size less than CycleSize in a Graph.
Returns a reference to an array of Path objects corresponding to paths of all possible lengths starting from each vertex with no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an arrays of Path objects list of paths between StartVertexID and EndVertexID. For cyclic graphs, the list contains may contain more than one Path object.
Returns an array of Path objects corresponding to all possible lengths starting from a specified StartVertexID with no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects corresponding to all paths starting from a specified StartVertexID with length Length and no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects corresponding to all paths starting from a specified StartVertexID with length upto Length and no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects corresponding to to paths starting from each vertex in graph with specified <Length> and no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns an array of Path objects corresponding to to paths starting from each vertex in graph with length upto specified Length and no sharing of edges in paths traversed. By default, cycles are included in paths. A path containing a cycle is terminated at a vertex completing the cycle.
Returns Siedel admittance matrix for Graph as a GraphMatrix object with row and column indices corresponding to graph vertices returned by GetVertices method.
For a simple graph G with n vertices, the Siedal adjacency matrix for G is a n x n square matrix and its elements Mij are:
Returns size of the largest cycle in a Graph.
Returns size of the largest cycle containing egde between VertextID1 and VertexID2 in a Graph.
Returns size of the largest cycle containing VertextID in a Graph.
Returns size of the smallest cycle in a Graph.
Returns size of the smallest cycle containing egde between VertextID1 and VertexID2 in a Graph.
Returns size of the smallest cycle containing VertextID in a Graph.
Returns a cyclic Path object corresponding to smallest cycle in a Graph.
Returns a cyclic Path object corresponding to smallest cycle containing edge between VertexID1 and VertexID2 in a Graph.
Returns a cyclic Path object corresponding to smallest cycle containing VertexID in a Graph.
Returns an array of VertexIDs sorted topologically starting from a specified RootVertexID or from an arbitrary vertex ID.
Returns vartex value for VertexID in a Graph. Vartex IDs and values are equivalent in the current implementation of Graph.
Returns an array CyclicPaths containing Path objects corresponding to all cycles containing VertexID in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with even size containing VertexID in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with odd size containing VertexID in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size CycleSize containing VertexID in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size greater than CycleSize containing VertexID in a Graph.
Returns an array CyclicPaths containing Path objects corresponding to cycles with size less than CycleSize containing VertexID in a Graph.
Returns a hash VertexProperties containing all PropertyName and PropertyValue pairs associated with a VertexID in a Graph.
Returns value of PropertyName associated with a VertexID in a Graph.
Returns VertexID with largest degree in a Graph.
Returns VertexID with smallest degree in a Graph.
Returns an array of VertexIDs corresponding to all vertices in a Graph; in a scalar context, number of vertices is returned.
Returns an array PropertyValues containing property values corresponding to PropertyName associated with with VertexIDs in a Graph.
Returns an array of VertexIDs containing vertices with degree less than Degree in a Graph.
Returns 1 or 0 based on whether edges between successive pair of VertexIDs including an additional edge from the last to first vertex ID exists in a Graph.
Returns 1 or 0 based on whether an edge between VertexID1 and VertexID2 exist in a Graph.
Returns 1 or 0 based on whether PropertyName has already been associated with an edge between VertexID1 and VertexID2 in a Graph.
Returns an array EdgesStatus containing 1s and 0s corresponding to whether edges between successive pairs of VertexIDs exist in a Graph. In a scalar context, number of edges found is returned.
Returns 1 or 0 based on whether any fused cycles exist in a Graph.
Returns 1 or 0 based on whether PropertyName has already been associated as a graph property as opposed to vertex or edge property in a Graph.
Returns 1 or 0 based on whether edges between all successive pairs of VertexIDs exist in a Graph.
Returns 1 or 0 based on whether VertexID exists in a Graph.
Returns 1 or 0 based on whether PropertyName has already been associated with VertexID in a Graph.
Returns an array containing 1s and 0s corresponding to whether VertexIDs exist in a Graph. In a scalar context, number of vertices found is returned.
Returns 0 or 1 based on whether a cycle exist in a Graph.
Returns 0 or 1 based on whether a cycle containing an edge between VertexID1 and VertexID2 exists in a Graph.
Returns 0 or 1 based on whether a cycle containing a VertexID exists in a Graph.
Returns 1 or 0 based on whether a cycle exist in a Graph.
Returns 1 or 0 based on whether a cycle containing an edge between VertexID1 and VertexID2 exists in a Graph.
Returns 1 or 0 based on whether a cycle containing a VertexID exists in a Graph.
Returns 1 or 0 based on whether Object is a Graph object.
Returns 1 or 0 based on whether VertexID is an isolated vertex in a Graph. A vertex with zero as its degree value is considered an isolated vertex.
Returns 1 or 0 based on whether VertexID is an isolated vertex in a Graph. A vertex with one as its degree value is considered an isolated vertex.
Returns 1 or 0 based on whether only one cycle is present in a Graph.
Returns 1 or 0 based on whether only one cycle contains the edge between VertexID1 and VertexID2 in a Graph.
Returns 1 or 0 based on whether only one cycle contains VertexID in a Graph.
Sets the type of cyclic paths to use during all methods related to cycles and returns Graph. Possible values for cyclic paths: Independent or All.
Associates property names and values corresponding to successive pairs of values in NamesAndValues to an edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Associates property Name and Value to an edge between VertexID1 and VertexID2 in a Graph and returns Graph.
Associates a same property Name but different Values for different edges specified using triplets of PropertyValue, $VertexID1, $VertexID2 via ValuesAndVertexIDs in a graph.
Associates property names and values NamesAndValues hash to graph as opposed to vertex or edge and returns Graph.
Associates property Name and Value to graph as opposed to vertex or edge and returns Graph.
Associates property names and values corresponding to successive pairs of values in NamesAndValues to VertexID in a Graph and returns Graph.
Associates property Name and Value to VertexID in a Graph and returns Graph.
Associates a same property Name but different Values for different vertices specified using doublets of PropertyValue, $VertexID via ValuesAndVertexIDs in a graph.
Returns a string containing information about properties associated with all edges in a Graph object.
Returns a string containing information about Graph object.
Returns a string containing information about properties associated with graph as opposed to vertex. or an edge in a Graph object
Returns a string containing information about properties associated with graph, vertices, and edges in a Graph object.
Returns a string containing information about vertices and edges in a Graph object.
Returns a string containing information about properties associated with vertices a Graph object.
Updates property Value for Name associated with an edge between VertexID1 and VertexID1 and returns Graph.
Updates property Value for Name associated with VertexID and returns Graph.
CyclesDetection.pm, Path.pm, PathGraph.pm, PathsTraversal.pm
Copyright (C) 2024 Manish Sud. All rights reserved.
This file is part of MayaChemTools.
MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.