Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
|
#include <graph_info.h>
Classes | |
class | Impl |
Public Member Functions | |
GraphInfo (const std::string &graph_name, VertexInfoVector vertex_infos, EdgeInfoVector edge_infos, const std::string &prefix="./", std::shared_ptr< const InfoVersion > version=nullptr, const std::unordered_map< std::string, std::string > &extra_info={}) | |
Constructs a GraphInfo instance. More... | |
Result< std::shared_ptr< GraphInfo > > | AddVertex (std::shared_ptr< VertexInfo > vertex_info) const |
Adds a vertex info to the GraphInfo instance and returns a new GraphInfo. More... | |
Result< std::shared_ptr< GraphInfo > > | AddEdge (std::shared_ptr< EdgeInfo > edge_info) const |
Adds an edge info to the GraphInfo instance and returns a new GraphInfo. More... | |
const std::string & | GetName () const |
Get the name of the graph. More... | |
const std::string & | GetPrefix () const |
Get the absolute path prefix of the chunk files. More... | |
const std::shared_ptr< const InfoVersion > & | version () const |
Get the version info of the graph info object. More... | |
const std::unordered_map< std::string, std::string > & | GetExtraInfo () const |
Get the extra metadata of the graph info object. More... | |
std::shared_ptr< VertexInfo > | GetVertexInfo (const std::string &label) const |
Get the vertex info with the given label. More... | |
std::shared_ptr< EdgeInfo > | GetEdgeInfo (const std::string &src_label, const std::string &edge_label, const std::string &dst_label) const |
Get the edge info with the given source vertex label, edge label, and destination vertex label. More... | |
int | GetVertexInfoIndex (const std::string &label) const |
Get the vertex info index with the given label. | |
int | GetEdgeInfoIndex (const std::string &src_label, const std::string &edge_label, const std::string &dst_label) const |
Get the edge info index with the given source vertex label, edge label, and destination label. | |
int | VertexInfoNum () const |
Get the number of vertex infos. | |
int | EdgeInfoNum () const |
Get the number of edge infos. | |
const std::shared_ptr< VertexInfo > | GetVertexInfoByIndex (int index) const |
Get the vertex info at the specified index. More... | |
const std::shared_ptr< EdgeInfo > | GetEdgeInfoByIndex (int index) const |
Get the edge info at the specified index. More... | |
const VertexInfoVector & | GetVertexInfos () const |
Get the vertex infos of graph info. More... | |
const EdgeInfoVector & | GetEdgeInfos () const |
Get the edge infos of graph info. More... | |
Status | Save (const std::string &path) const |
Result< std::string > | Dump () const |
bool | IsValidated () const |
Static Public Member Functions | |
static Result< std::shared_ptr< GraphInfo > > | Load (const std::string &path) |
Loads the input file as a GraphInfo instance. More... | |
static Result< std::shared_ptr< GraphInfo > > | Load (const std::string &input, const std::string &relative_path) |
Loads the input string as a GraphInfo instance. More... | |
GraphInfo is a class to store the graph meta information.
Definition at line 690 of file graph_info.h.
|
explicit |
Constructs a GraphInfo instance.
graph_name | The name of the graph. |
vertex_infos | The vertex info vector of the graph. |
edge_infos | The edge info vector of the graph. |
prefix | The absolute path prefix to store chunk files of the graph. Defaults to "./". |
version | The version of the graph info. |
extra_info | The extra metadata of the graph info. |
Definition at line 1111 of file graph_info.cc.
Result< std::shared_ptr< GraphInfo > > graphar::GraphInfo::AddEdge | ( | std::shared_ptr< EdgeInfo > | edge_info | ) | const |
Adds an edge info to the GraphInfo instance and returns a new GraphInfo.
edge_info | The edge info to add. |
InvalidOperation
if the edge info is already contained. Definition at line 1204 of file graph_info.cc.
Result< std::shared_ptr< GraphInfo > > graphar::GraphInfo::AddVertex | ( | std::shared_ptr< VertexInfo > | vertex_info | ) | const |
Adds a vertex info to the GraphInfo instance and returns a new GraphInfo.
vertex_info | The vertex info to add. |
Definition at line 1191 of file graph_info.cc.
Result< std::string > graphar::GraphInfo::Dump | ( | ) | const |
Returns the graph info as a YAML formatted string.
Definition at line 1257 of file graph_info.cc.
std::shared_ptr< EdgeInfo > graphar::GraphInfo::GetEdgeInfo | ( | const std::string & | src_label, |
const std::string & | edge_label, | ||
const std::string & | dst_label | ||
) | const |
Get the edge info with the given source vertex label, edge label, and destination vertex label.
src_label | The label of the source vertex. |
edge_label | The label of the edge. |
dst_label | The label of the destination vertex. |
Definition at line 1144 of file graph_info.cc.
const std::shared_ptr< EdgeInfo > graphar::GraphInfo::GetEdgeInfoByIndex | ( | int | index | ) | const |
Get the edge info at the specified index.
index | The index of the edge info. |
Definition at line 1174 of file graph_info.cc.
const EdgeInfoVector & graphar::GraphInfo::GetEdgeInfos | ( | ) | const |
Get the edge infos of graph info.
Definition at line 1185 of file graph_info.cc.
const std::unordered_map< std::string, std::string > & graphar::GraphInfo::GetExtraInfo | ( | ) | const |
Get the extra metadata of the graph info object.
Definition at line 1129 of file graph_info.cc.
const std::string & graphar::GraphInfo::GetName | ( | ) | const |
Get the name of the graph.
Definition at line 1121 of file graph_info.cc.
const std::string & graphar::GraphInfo::GetPrefix | ( | ) | const |
Get the absolute path prefix of the chunk files.
Definition at line 1123 of file graph_info.cc.
std::shared_ptr< VertexInfo > graphar::GraphInfo::GetVertexInfo | ( | const std::string & | label | ) | const |
Get the vertex info with the given label.
label | The label of the vertex. |
Definition at line 1134 of file graph_info.cc.
const std::shared_ptr< VertexInfo > graphar::GraphInfo::GetVertexInfoByIndex | ( | int | index | ) | const |
Get the vertex info at the specified index.
index | The index of the vertex info. |
Definition at line 1166 of file graph_info.cc.
const VertexInfoVector & graphar::GraphInfo::GetVertexInfos | ( | ) | const |
Get the vertex infos of graph info.
Definition at line 1181 of file graph_info.cc.
bool graphar::GraphInfo::IsValidated | ( | ) | const |
Returns whether the graph info is validated.
Definition at line 1189 of file graph_info.cc.
|
static |
Loads the input string as a GraphInfo
instance.
input | The YAML content string. |
relative_path | The relative path to access vertex/edge YAML. |
Definition at line 1244 of file graph_info.cc.
|
static |
Loads the input file as a GraphInfo
instance.
path | The path of the YAML file. |
Definition at line 1231 of file graph_info.cc.
Status graphar::GraphInfo::Save | ( | const std::string & | path | ) | const |
Saves the graph info to a YAML file.
path | The path of the file to save to. |
Definition at line 1300 of file graph_info.cc.
const std::shared_ptr< const InfoVersion > & graphar::GraphInfo::version | ( | ) | const |
Get the version info of the graph info object.
Definition at line 1125 of file graph_info.cc.