SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
gsvd.h
Go to the documentation of this file.
1 //#//////////////////////////////////////////////
5 class TNGraphMtx : public TMatrix {
6 private:
8  bool CheckNodeIds();
9 public:
10  TNGraphMtx(const PNGraph& GraphPt);
11  TNGraphMtx(const TNGraphMtx& GraphMtx) : Graph(GraphMtx.Graph) { }
12  TNGraphMtx& operator = (const TNGraphMtx& GraphMtx) { Graph=GraphMtx.Graph; return *this; }
13  int PGetRows() const { return Graph->GetNodes(); }
14  int PGetCols() const { return Graph->GetNodes(); }
15  // Result = A * B(:,ColId)
16  void PMultiply(const TFltVV& B, int ColId, TFltV& Result) const;
17  // Result = A * Vec
18  void PMultiply(const TFltV& Vec, TFltV& Result) const;
19  // Result = A' * B(:,ColId)
20  void PMultiplyT(const TFltVV& B, int ColId, TFltV& Result) const;
21  // Result = A' * Vec
22  void PMultiplyT(const TFltV& Vec, TFltV& Result) const;
23 };
24 
25 //#//////////////////////////////////////////////
29 class TUNGraphMtx : public TMatrix {
30 private:
32  bool CheckNodeIds();
33 public:
34  TUNGraphMtx(const PUNGraph& GraphPt);
35  TUNGraphMtx(const TUNGraphMtx& GraphMtx) : Graph(GraphMtx.Graph) { }
36  TUNGraphMtx& operator = (const TUNGraphMtx& GraphMtx) { Graph=GraphMtx.Graph; return *this; }
37  int PGetRows() const { return Graph->GetNodes(); }
38  int PGetCols() const { return Graph->GetNodes(); }
39  // Result = A * B(:,ColId)
40  void PMultiply(const TFltVV& B, int ColId, TFltV& Result) const;
41  // Result = A * Vec
42  void PMultiply(const TFltV& Vec, TFltV& Result) const;
43  // Result = A' * B(:,ColId)
44  void PMultiplyT(const TFltVV& B, int ColId, TFltV& Result) const;
45  // Result = A' * Vec
46  void PMultiplyT(const TFltV& Vec, TFltV& Result) const;
47 };
48 
50 // Graphs Singular Value Decomposition of Graph Adjacency Matrix
51 namespace TSnap {
52 
54 void GetSngVals(const PNGraph& Graph, const int& SngVals, TFltV& SngValV);
56 void GetSngVec(const PNGraph& Graph, TFltV& LeftSV, TFltV& RightSV);
59 void GetSngVec(const PNGraph& Graph, const int& SngVecs, TFltV& SngValV, TFltVFltV& LeftSV, TFltVFltV& RightSV);
60 
62 void GetEigVals(const PUNGraph& Graph, const int& EigVals, TFltV& EigValV);
64 void GetEigVec(const PUNGraph& Graph, TFltV& EigVecV);
66 //void GetEigVec(const PUNGraph& Graph, const int& EigVecs, TFltV& EigValV, TVec<TFltV>& EigVecV);
67 void GetEigVec(const PUNGraph& Graph, const int& EigVecs, TFltV& EigValV, TFltVFltV& EigVecV);
70 void GetInvParticipRat(const PUNGraph& Graph, int MaxEigVecs, int TimeLimit, TFltPrV& EigValIprV);
71 
72 namespace TSnapDetail {
73 double GetInvParticipRatEig(const TFltV& EigVec);
74 } // namespace TSnapDetail
75 
76 }; // namespace TSnap
void GetEigVals(const PUNGraph &Graph, const int &EigVals, TFltV &EigValV)
Computes top EigVals eigenvalues of the adjacency matrix representing a given undirected Graph...
Definition: gsvd.cpp:308
double GetInvParticipRatEig(const TFltV &EigVec)
Definition: gsvd.cpp:402
Main namespace for all the Snap global entities.
Definition: alg.h:1
void GetInvParticipRat(const PUNGraph &Graph, int MaxEigVecs, int TimeLimit, TFltPrV &EigValIprV)
Definition: gsvd.cpp:378
int PGetRows() const
Definition: gsvd.h:37
void GetEigVec(const PUNGraph &Graph, TFltV &EigVecV)
Computes the leading eigenvector of the adjacency matrix representing a given undirected Graph...
Definition: gsvd.cpp:336
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graph.h:503
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graph.h:192
TNGraphMtx(const PNGraph &GraphPt)
Definition: gsvd.cpp:10
int PGetCols() const
Definition: gsvd.h:14
TNGraphMtx & operator=(const TNGraphMtx &GraphMtx)
Definition: gsvd.h:12
void GetSngVec(const PNGraph &Graph, TFltV &LeftSV, TFltV &RightSV)
Computes the leading left and right singular vector of the adjacency matrix representing a directed G...
Definition: gsvd.cpp:225
TUNGraphMtx(const PUNGraph &GraphPt)
Definition: gsvd.cpp:83
TUNGraphMtx(const TUNGraphMtx &GraphMtx)
Definition: gsvd.h:35
void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
Definition: gsvd.cpp:47
Definition: gsvd.h:5
TNGraphMtx(const TNGraphMtx &GraphMtx)
Definition: gsvd.h:11
PNGraph Graph
Definition: gsvd.h:7
void PMultiplyT(const TFltVV &B, int ColId, TFltV &Result) const
Definition: gsvd.cpp:127
TUNGraphMtx & operator=(const TUNGraphMtx &GraphMtx)
Definition: gsvd.h:36
PUNGraph Graph
Definition: gsvd.h:31
int PGetRows() const
Definition: gsvd.h:13
int PGetCols() const
Definition: gsvd.h:38
Definition: linalg.h:8
void GetSngVals(const PNGraph &Graph, const int &SngVals, TFltV &SngValV)
Computes largest SngVals singular values of the adjacency matrix representing a directed Graph...
Definition: gsvd.cpp:175
bool CheckNodeIds()
Definition: gsvd.cpp:76
void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const
Definition: gsvd.cpp:99
bool CheckNodeIds()
Definition: gsvd.cpp:3
void PMultiply(const TFltVV &B, int ColId, TFltV &Result) const
Definition: gsvd.cpp:19