5 int main(
int argc,
char* argv[]) {
8 for (
int i = 0; i < 10; i++) {
10 for (
int i = 0; i < 10; i++) {
11 Graph->AddEdge(i,
TInt::Rnd.GetUniDevInt(10)); }
15 Graph = TSnap::LoadEdgeList<PNGraph>(
"graph.txt", 0, 1);
18 printf(
"NodeId: %d, InDegree: %d, OutDegree: %d\n", NI.GetId(), NI.GetInDeg(), NI.GetOutDeg());
20 for (
int e = 0; e < NI.GetOutDeg(); e++) { printf(
" %d", NI.GetOutNId(e)); }
21 printf(
"\nInNodes: ");
22 for (
int e = 0; e < NI.GetInDeg(); e++) { printf(
" %d", NI.GetInNId(e)); }
30 PNGraph RndGraph = TSnap::GenRndGnm<PNGraph>(100, 1000);
32 GraphStat.PlotAll(
"RndGraph",
"Random graph on 1000 nodes");
34 {
TFfGGen ForestFire(
false, 1, 0.35, 0.30, 1.0, 0.0, 0.0);
39 Net->AddNode(0,
"zero");
40 Net->AddNode(1,
"one");
41 Net->AddEdge(0, 1,
"zero to one");
TStopReason GenGraph(const int &GraphNodes, const bool &FloodStop=true)
PGraph GetMxWcc(const PGraph &Graph)
Returns a graph representing the largest weakly connected component on an input Graph.
static PNGraph New()
Static constructor that returns a pointer to the graph. Call: PNGraph Graph = TNGraph::New().
static PNet New()
Static constructor that returns a pointer to the network. Call: TPt > Net = TNodeEDatNet::New().
Statistics of a Graph Snapshot.
void SaveEdgeList(const PGraph &Graph, const TStr &OutFNm, const TStr &Desc=TStr())
Saves a graph into a text file. Each line contains two columns and encodes a single edge:
int main(int argc, char *argv[])
Node iterator. Only forward iteration (operator++) is supported.
void PrintInfo(const PGraph &Graph, const TStr &Desc="", const TStr &OutFNm="", const bool &Fast=true)
Prints basic graph statistics.