0

here a input is a matrix

#include<iostream>
using namespace std;
int main()
{
int matrix[n][n]={0};
for(j=0;j<no_edges;j++) //no_edges----max edges in the matrix
{
 cin>>row>>col;
 matrix[row][col]=1;
 matrix[col][row]=1;
}
eigen(matrix);
}
eigen(matrix[][])
{
 //defination?????
}

here all the inputs of the matrix n*n is either 1 or 0... n=3 also matrix is symmetrical along its diagonal and has 0 value in its diagonal={(0,1,0);(1,0,1);(0,1,0)}.Also i think performance can be improved using adjacency list...But how to multiply a adjacency list as awe do in adjacency matrix?

ArK
  • 20,698
  • 67
  • 109
  • 136
Manav Jain
  • 37
  • 1
  • 7
  • Since your matrix is symmetric, you can use SVD to get the eigenvalues. [SuiteSparse](http://faculty.cse.tamu.edu/davis/suitesparse.html) has some efficient implementations for sparse matrices. – Nico Schertler Aug 21 '16 at 11:57
  • Are you using this to compute some feature of a graph? If so, does your graph have any special structure and which feature are you trying to compute? – Peter de Rivaz Aug 21 '16 at 18:57
  • total no of different triangles in a graph – Manav Jain Aug 22 '16 at 11:46
  • There may be some useful answers here: http://stackoverflow.com/questions/7396570/what-is-an-efficient-algorithm-for-counting-the-number-of-triangles-in-a-graph but it looks like this is hard unless you have some special structure (such as a sparse graph). – Peter de Rivaz Aug 22 '16 at 12:05

0 Answers0