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
gviz.h
Go to the documentation of this file.
1 //#//////////////////////////////////////////////
4 
6 // GraphViz
7 namespace TSnap {
9 
14 template<class PGraph> void DrawGViz(const PGraph& Graph, const TGVizLayout& Layout, const TStr& PltFNm, const TStr& Desc=TStr(), const bool& NodeLabels=false, const TIntStrH& NIdColorH=TIntStrH());
16 
21 template<class PGraph> void DrawGViz(const PGraph& Graph, const TGVizLayout& Layout, const TStr& PltFNm, const TStr& Desc, const TIntStrH& NodeLabelH);
22 
23 namespace TSnapDetail {
25 void GVizDoLayout(const TStr& GraphInFNm, TStr OutFNm, const TGVizLayout& Layout);
27 TStr GVizGetLayoutStr(const TGVizLayout& Layout);
28 } // namespace TSnapDetail
29 
31 // GraphViz implementation
32 
33 template<class PGraph>
34 void DrawGViz(const PGraph& Graph, const TGVizLayout& Layout, const TStr& PltFNm, const TStr& Desc, const bool& NodeLabels, const TIntStrH& NIdColorH) {
35  const TStr Ext = PltFNm.GetFExt();
36  const TStr GraphFNm = PltFNm.GetSubStr(0, PltFNm.Len()-Ext.Len()) + "dot";
37  SaveGViz(Graph, GraphFNm, Desc, NodeLabels, NIdColorH);
38  TSnap::TSnapDetail::GVizDoLayout(GraphFNm, PltFNm, Layout);
39 }
40 
41 template<class PGraph>
42 void DrawGViz(const PGraph& Graph, const TGVizLayout& Layout, const TStr& PltFNm, const TStr& Desc, const TIntStrH& NodeLabelH) {
43  const TStr Ext = PltFNm.GetFExt();
44  const TStr GraphFNm = PltFNm.GetSubStr(0, PltFNm.Len()-Ext.Len()) + "dot";
45  SaveGViz(Graph, GraphFNm, Desc, NodeLabelH);
46  TSnap::TSnapDetail::GVizDoLayout(GraphFNm, PltFNm, Layout);
47 }
48 
49 } // namespace TSNap
void DrawGViz(const PGraph &Graph, const TGVizLayout &Layout, const TStr &PltFNm, const TStr &Desc=TStr(), const bool &NodeLabels=false, const TIntStrH &NIdColorH=TIntStrH())
Draws a given Graph using a selected GraphViz Layout engine with nodes colored.
Definition: gviz.h:34
Definition: gviz.h:3
Main namespace for all the Snap global entities.
Definition: alg.h:1
int Len() const
Definition: dt.h:490
void SaveGViz(const PGraph &Graph, const TStr &OutFNm, const TStr &Desc=TStr(), const bool &NodeLabels=false, const TIntStrH &NIdColorH=TIntStrH())
Save a graph in GraphVizp .DOT format.
Definition: gio.h:387
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr GetFExt() const
Definition: dt.cpp:1421
THash< TInt, TStr > TIntStrH
Definition: hash.h:619
Definition: gviz.h:3
void GVizDoLayout(const TStr &GraphInFNm, TStr OutFNm, const TGVizLayout &Layout)
Runs GraphViz layout engine over a graph saved in the file GraphInFNm with output saved to OutFNm...
Definition: gviz.cpp:5
TGVizLayout_
GraphViz Layout Engines.
Definition: gviz.h:3
Definition: gviz.h:3
Definition: gviz.h:3
Definition: gviz.h:3
Definition: dt.h:412
enum TGVizLayout_ TGVizLayout
GraphViz Layout Engines.
TStr GVizGetLayoutStr(const TGVizLayout &Layout)
Generates the GraphViz command string based on the selected Layout engine.
Definition: gviz.cpp:30