SNAP Library 2.1, Developer Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
gsvd.h
Go to the documentation of this file.
00001 //#//////////////////////////////////////////////
00005 class TNGraphMtx : public TMatrix {
00006 private:
00007   PNGraph Graph;
00008   bool CheckNodeIds();
00009 public:
00010   TNGraphMtx(const PNGraph& GraphPt);
00011   TNGraphMtx(const TNGraphMtx& GraphMtx) : Graph(GraphMtx.Graph) { }
00012   TNGraphMtx& operator = (const TNGraphMtx& GraphMtx) { Graph=GraphMtx.Graph;  return *this; }
00013   int PGetRows() const { return Graph->GetNodes(); }
00014   int PGetCols() const { return Graph->GetNodes(); }
00015   // Result = A * B(:,ColId)
00016   void PMultiply(const TFltVV& B, int ColId, TFltV& Result) const;
00017   // Result = A * Vec
00018   void PMultiply(const TFltV& Vec, TFltV& Result) const;
00019   // Result = A' * B(:,ColId)
00020   void PMultiplyT(const TFltVV& B, int ColId, TFltV& Result) const;
00021   // Result = A' * Vec
00022   void PMultiplyT(const TFltV& Vec, TFltV& Result) const;
00023 };
00024 
00025 //#//////////////////////////////////////////////
00029 class TUNGraphMtx : public TMatrix {
00030 private:
00031   PUNGraph Graph;
00032   bool CheckNodeIds();
00033 public:
00034   TUNGraphMtx(const PUNGraph& GraphPt);
00035   TUNGraphMtx(const TUNGraphMtx& GraphMtx) : Graph(GraphMtx.Graph) { }
00036   TUNGraphMtx& operator = (const TUNGraphMtx& GraphMtx) { Graph=GraphMtx.Graph;  return *this; }
00037   int PGetRows() const { return Graph->GetNodes(); }
00038   int PGetCols() const { return Graph->GetNodes(); }
00039   // Result = A * B(:,ColId)
00040   void PMultiply(const TFltVV& B, int ColId, TFltV& Result) const;
00041   // Result = A * Vec
00042   void PMultiply(const TFltV& Vec, TFltV& Result) const;
00043   // Result = A' * B(:,ColId)
00044   void PMultiplyT(const TFltVV& B, int ColId, TFltV& Result) const;
00045   // Result = A' * Vec
00046   void PMultiplyT(const TFltV& Vec, TFltV& Result) const;
00047 };
00048 
00050 // Graphs Singular Value Decomposition of Graph Adjacency Matrix
00051 namespace TSnap {
00052 
00054 void GetSngVals(const PNGraph& Graph, const int& SngVals, TFltV& SngValV);
00056 void GetSngVec(const PNGraph& Graph, TFltV& LeftSV, TFltV& RightSV);
00059 void GetSngVec(const PNGraph& Graph, const int& SngVecs, TFltV& SngValV, TVec<TFltV>& LeftSV, TVec<TFltV>& RightSV);
00060 
00062 void GetEigVals(const PUNGraph& Graph, const int& EigVals, TFltV& EigValV);
00064 void GetEigVec(const PUNGraph& Graph, TFltV& EigVecV);
00066 void GetEigVec(const PUNGraph& Graph, const int& EigVecs, TFltV& EigValV, TVec<TFltV>& EigVecV);
00069 void GetInvParticipRat(const PUNGraph& Graph, int MaxEigVecs, int TimeLimit, TFltPrV& EigValIprV);
00070 
00071 namespace TSnapDetail {
00072 double GetInvParticipRatEig(const TFltV& EigVec);
00073 } // namespace TSnapDetail
00074 
00075 }; // namespace TSnap