Catalano.Graph
Class AdjacencyMatrix
- java.lang.Object
-
- Catalano.Graph.AdjacencyMatrix
-
public class AdjacencyMatrix extends java.lang.ObjectAdjacency Matrix.
-
-
Constructor Summary
Constructors Constructor and Description AdjacencyMatrix(double[][] matrix)Initializes a new instance of the AdjacencyMatrix class.AdjacencyMatrix(int edges)Initializes a new instance of the AdjacencyMatrix class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static double[][]CreateStochasticMatrix(double[][] matrix)Create stochastic matrix.doublegetAverageDegree()Computes the average degree of a node in a graph.double[][]getData()Get data from the adjacency matrix.intgetEdgeByMaxDegree()Get edge by maximum degree.doublegetLinkDensity()Computes the link density of a graph.intgetMaxDegree()Get the maximum degree.intgetNumberOfEdges()Get number of edges.intgetNumberOfNodes()Get number of nodes.intgetNumberOfSelfLoops()Get Number of self loops in the graph.booleanisSymmetric()Check if the adjacency matrix is symmetric.voidsetData(double[][] data)Set data in the adjacency matrix.voidsetStochasticMatrix()Create stochastic matrix.
-
-
-
Constructor Detail
-
AdjacencyMatrix
public AdjacencyMatrix(int edges)
Initializes a new instance of the AdjacencyMatrix class.- Parameters:
edges- Number of the edges.
-
AdjacencyMatrix
public AdjacencyMatrix(double[][] matrix)
Initializes a new instance of the AdjacencyMatrix class.- Parameters:
matrix- Matrix.
-
-
Method Detail
-
getData
public double[][] getData()
Get data from the adjacency matrix.- Returns:
- Data.
-
getNumberOfNodes
public int getNumberOfNodes()
Get number of nodes.- Returns:
- Number of nodes.
-
getAverageDegree
public double getAverageDegree()
Computes the average degree of a node in a graph.- Returns:
- Average degree.
-
getLinkDensity
public double getLinkDensity()
Computes the link density of a graph.- Returns:
- Link density.
-
getNumberOfEdges
public int getNumberOfEdges()
Get number of edges.- Returns:
- Number of edges.
-
getNumberOfSelfLoops
public int getNumberOfSelfLoops()
Get Number of self loops in the graph.- Returns:
- Number of self loops.
-
setData
public void setData(double[][] data)
Set data in the adjacency matrix.- Parameters:
data- Data.
-
getMaxDegree
public int getMaxDegree()
Get the maximum degree.- Returns:
- Maximum degree.
-
getEdgeByMaxDegree
public int getEdgeByMaxDegree()
Get edge by maximum degree.- Returns:
- Edge.
-
CreateStochasticMatrix
public static double[][] CreateStochasticMatrix(double[][] matrix)
Create stochastic matrix.- Parameters:
matrix- Matrix.- Returns:
- Stochastic matrix.
-
setStochasticMatrix
public void setStochasticMatrix()
Create stochastic matrix.
-
isSymmetric
public boolean isSymmetric()
Check if the adjacency matrix is symmetric.- Returns:
- True if is symmetric, otherwise false.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG