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::vector< std::string > &labels={}, 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::vector< std::string > & | GetLabels () const |
Get the vertex labels 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 &type) const |
Get the vertex info with the given type. More... | |
std::shared_ptr< EdgeInfo > | GetEdgeInfo (const std::string &src_type, const std::string &edge_type, const std::string &dst_type) const |
Get the edge info with the given source vertex type, edge type, and destination vertex type. More... | |
int | GetVertexInfoIndex (const std::string &type) const |
Get the vertex info index with the given type. | |
int | GetEdgeInfoIndex (const std::string &src_type, const std::string &edge_type, const std::string &dst_type) const |
Get the edge info index with the given source vertex type, edge type, and destination type. | |
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 706 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. |
labels | The vertex labels 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 1184 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 1281 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 1268 of file graph_info.cc.
Result< std::string > graphar::GraphInfo::Dump | ( | ) | const |
Returns the graph info as a YAML formatted string.
Definition at line 1334 of file graph_info.cc.
std::shared_ptr< EdgeInfo > graphar::GraphInfo::GetEdgeInfo | ( | const std::string & | src_type, |
const std::string & | edge_type, | ||
const std::string & | dst_type | ||
) | const |
Get the edge info with the given source vertex type, edge type, and destination vertex type.
src_type | The type of the source vertex. |
edge_type | The type of the edge. |
dst_type | The type of the destination vertex. |
Definition at line 1221 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 1251 of file graph_info.cc.
const EdgeInfoVector & graphar::GraphInfo::GetEdgeInfos | ( | ) | const |
Get the edge infos of graph info.
Definition at line 1262 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 1206 of file graph_info.cc.
const std::vector< std::string > & graphar::GraphInfo::GetLabels | ( | ) | const |
Get the vertex labels of the graph.
Definition at line 1196 of file graph_info.cc.
const std::string & graphar::GraphInfo::GetName | ( | ) | const |
Get the name of the graph.
Definition at line 1194 of file graph_info.cc.
const std::string & graphar::GraphInfo::GetPrefix | ( | ) | const |
Get the absolute path prefix of the chunk files.
Definition at line 1200 of file graph_info.cc.
std::shared_ptr< VertexInfo > graphar::GraphInfo::GetVertexInfo | ( | const std::string & | type | ) | const |
Get the vertex info with the given type.
type | The type of the vertex. |
Definition at line 1211 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 1243 of file graph_info.cc.
const VertexInfoVector & graphar::GraphInfo::GetVertexInfos | ( | ) | const |
Get the vertex infos of graph info.
Definition at line 1258 of file graph_info.cc.
bool graphar::GraphInfo::IsValidated | ( | ) | const |
Returns whether the graph info is validated.
Definition at line 1266 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 1321 of file graph_info.cc.
|
static |
Loads the input file as a GraphInfo
instance.
path | The path of the YAML file. |
Definition at line 1308 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 1384 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 1202 of file graph_info.cc.