Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
Classes | Public Member Functions | Static Public Member Functions | List of all members
graphar::EdgeInfo Class Reference

EdgeInfo is a class to describe the edge information, including the source vertex label, edge label, destination vertex label, chunk size, adjacent list property groups, and prefix. More...

#include <graph_info.h>

Classes

class  Impl
 

Public Member Functions

 EdgeInfo (const std::string &src_label, const std::string &edge_label, const std::string &dst_label, IdType chunk_size, IdType src_chunk_size, IdType dst_chunk_size, bool directed, const AdjacentListVector &adjacent_lists, const PropertyGroupVector &property_groups, const std::string &prefix="", std::shared_ptr< const InfoVersion > version=nullptr)
 Construct an EdgeInfo object with the given information and property groups. More...
 
Result< std::shared_ptr< EdgeInfo > > AddAdjacentList (std::shared_ptr< AdjacentList > adj_list) const
 
Result< std::shared_ptr< EdgeInfo > > AddPropertyGroup (std::shared_ptr< PropertyGroup > property_group) const
 
const std::string & GetSrcLabel () const
 
const std::string & GetEdgeLabel () const
 
const std::string & GetDstLabel () const
 
IdType GetChunkSize () const
 
IdType GetSrcChunkSize () const
 
IdType GetDstChunkSize () const
 
const std::string & GetPrefix () const
 
bool IsDirected () const
 
const std::shared_ptr< const InfoVersion > & version () const
 
bool HasAdjacentListType (AdjListType adj_list_type) const
 
bool HasProperty (const std::string &property_name) const
 Returns whether the edge info contains the given property. More...
 
bool HasPropertyGroup (const std::shared_ptr< PropertyGroup > &property_group) const
 Returns whether the edge info contains the given property group.
 
std::shared_ptr< AdjacentListGetAdjacentList (AdjListType adj_list_type) const
 
int PropertyGroupNum () const
 Get the number of property groups.
 
const PropertyGroupVector & GetPropertyGroups () const
 Get the property groups.
 
std::shared_ptr< PropertyGroupGetPropertyGroup (const std::string &property) const
 Get the property group containing the given property. More...
 
std::shared_ptr< PropertyGroupGetPropertyGroupByIndex (int index) const
 Get the property group at the specified index. More...
 
Result< std::string > GetVerticesNumFilePath (AdjListType adj_list_type) const
 Get the file path for the number of vertices. More...
 
Result< std::string > GetEdgesNumFilePath (IdType vertex_chunk_index, AdjListType adj_list_type) const
 
Result< std::string > GetAdjListFilePath (IdType vertex_chunk_index, IdType edge_chunk_index, AdjListType adj_list_type) const
 Get the file path of adj list topology chunk. More...
 
Result< std::string > GetAdjListPathPrefix (AdjListType adj_list_type) const
 Get the path prefix of the adjacency list topology chunk for the given adjacency list type. More...
 
Result< std::string > GetAdjListOffsetFilePath (IdType vertex_chunk_index, AdjListType adj_list_type) const
 Get the adjacency list offset chunk file path of vertex chunk the offset chunks is aligned with the vertex chunks. More...
 
Result< std::string > GetOffsetPathPrefix (AdjListType adj_list_type) const
 
Result< std::string > GetPropertyFilePath (const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type, IdType vertex_chunk_index, IdType edge_chunk_index) const
 Get the chunk file path of adj list property group the property group chunks is aligned with the adj list topology chunks. More...
 
Result< std::string > GetPropertyGroupPathPrefix (const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type) const
 
Result< std::shared_ptr< DataType > > GetPropertyType (const std::string &property_name) const
 
bool IsPrimaryKey (const std::string &property_name) const
 
bool IsNullableKey (const std::string &property_name) const
 
Status Save (const std::string &file_name) const
 
Result< std::string > Dump () const noexcept
 
bool IsValidated () const
 

Static Public Member Functions

static Result< std::shared_ptr< EdgeInfo > > Load (std::shared_ptr< Yaml > yaml)
 
static Result< std::shared_ptr< EdgeInfo > > Load (const std::string &input)
 

Detailed Description

EdgeInfo is a class to describe the edge information, including the source vertex label, edge label, destination vertex label, chunk size, adjacent list property groups, and prefix.

Definition at line 382 of file graph_info.h.

Constructor & Destructor Documentation

◆ EdgeInfo()

graphar::EdgeInfo::EdgeInfo ( const std::string &  src_label,
const std::string &  edge_label,
const std::string &  dst_label,
IdType  chunk_size,
IdType  src_chunk_size,
IdType  dst_chunk_size,
bool  directed,
const AdjacentListVector &  adjacent_lists,
const PropertyGroupVector &  property_groups,
const std::string &  prefix = "",
std::shared_ptr< const InfoVersion version = nullptr 
)
explicit

Construct an EdgeInfo object with the given information and property groups.

Parameters
src_labelThe label of the source vertex.
edge_labelThe label of the edge.
dst_labelThe label of the destination vertex.
chunk_sizeThe number of edges in each edge chunk.
src_chunk_sizeThe number of source vertices in each vertex chunk.
dst_chunk_sizeThe number of destination vertices in each vertex chunk.
directedWhether the edge is directed.
adjacent_listsThe adjacency list vector of the edge.
property_groupsThe property group vector of the edge.
prefixThe path prefix of the edge info.
versionThe version of the edge info.

Definition at line 586 of file graph_info.cc.

Member Function Documentation

◆ AddAdjacentList()

Result< std::shared_ptr< EdgeInfo > > graphar::EdgeInfo::AddAdjacentList ( std::shared_ptr< AdjacentList adj_list) const

Add an adjacency list information to the edge info and returns a new EdgeInfo. The adjacency list information indicating the adjacency list stored with CSR, CSC, or COO format.

Parameters
adj_listThe adjacency list to add.

Definition at line 775 of file graph_info.cc.

◆ AddPropertyGroup()

Result< std::shared_ptr< EdgeInfo > > graphar::EdgeInfo::AddPropertyGroup ( std::shared_ptr< PropertyGroup property_group) const

Add a property group to edge info and returns a new EdgeInfo.

Parameters
property_groupProperty group to add.

Definition at line 791 of file graph_info.cc.

◆ Dump()

Result< std::string > graphar::EdgeInfo::Dump ( ) const
noexcept

Returns the edge info as a YAML formatted string.

Returns
A Result object containing the YAML string, or a Status object indicating an error.

Definition at line 911 of file graph_info.cc.

◆ GetAdjListFilePath()

Result< std::string > graphar::EdgeInfo::GetAdjListFilePath ( IdType  vertex_chunk_index,
IdType  edge_chunk_index,
AdjListType  adj_list_type 
) const

Get the file path of adj list topology chunk.

Parameters
vertex_chunk_indexthe vertex chunk index
edge_chunk_indexindex of edge adj list chunk of the vertex chunk
adj_list_typeThe adjacency list type.

Definition at line 689 of file graph_info.cc.

◆ GetAdjListOffsetFilePath()

Result< std::string > graphar::EdgeInfo::GetAdjListOffsetFilePath ( IdType  vertex_chunk_index,
AdjListType  adj_list_type 
) const

Get the adjacency list offset chunk file path of vertex chunk the offset chunks is aligned with the vertex chunks.

Parameters
vertex_chunk_indexindex of vertex chunk
adj_list_typeThe adjacency list type.

Definition at line 707 of file graph_info.cc.

◆ GetAdjListPathPrefix()

Result< std::string > graphar::EdgeInfo::GetAdjListPathPrefix ( AdjListType  adj_list_type) const

Get the path prefix of the adjacency list topology chunk for the given adjacency list type.

Parameters
adj_list_typeThe adjacency list type.
Returns
A Result object containing the directory, or a Status object indicating an error.

Definition at line 699 of file graph_info.cc.

◆ GetChunkSize()

IdType graphar::EdgeInfo::GetChunkSize ( ) const

Get the number of edges in each edge chunk.

Returns
The number of edges in each edge chunk.

Definition at line 605 of file graph_info.cc.

◆ GetDstChunkSize()

IdType graphar::EdgeInfo::GetDstChunkSize ( ) const

Get the number of destination vertices in each vertex chunk.

Returns
The number of destination vertices in each vertex chunk.

Definition at line 609 of file graph_info.cc.

◆ GetDstLabel()

const std::string & graphar::EdgeInfo::GetDstLabel ( ) const

Get the label of the destination vertex.

Returns
The label of the destination vertex.

Definition at line 603 of file graph_info.cc.

◆ GetEdgeLabel()

const std::string & graphar::EdgeInfo::GetEdgeLabel ( ) const

Get the label of the edge.

Returns
The label of the edge.

Definition at line 601 of file graph_info.cc.

◆ GetEdgesNumFilePath()

Result< std::string > graphar::EdgeInfo::GetEdgesNumFilePath ( IdType  vertex_chunk_index,
AdjListType  adj_list_type 
) const

Get the file path for the number of edges.

Parameters
vertex_chunk_indexthe vertex chunk index
adj_list_typeThe adjacency list type.
Returns
A Result object containing the file path for the number of edges, or a Status object indicating an error.

Definition at line 681 of file graph_info.cc.

◆ GetOffsetPathPrefix()

Result< std::string > graphar::EdgeInfo::GetOffsetPathPrefix ( AdjListType  adj_list_type) const

Get the path prefix of the adjacency list offset chunk for the given adjacency list type.

Parameters
adj_list_typeThe adjacency list type.
Returns
A Result object containing the path prefix, or a Status object indicating an error.

Definition at line 715 of file graph_info.cc.

◆ GetPrefix()

const std::string & graphar::EdgeInfo::GetPrefix ( ) const

Get the path prefix of the edge.

Returns
The path prefix of the edge.

Definition at line 611 of file graph_info.cc.

◆ GetPropertyFilePath()

Result< std::string > graphar::EdgeInfo::GetPropertyFilePath ( const std::shared_ptr< PropertyGroup > &  property_group,
AdjListType  adj_list_type,
IdType  vertex_chunk_index,
IdType  edge_chunk_index 
) const

Get the chunk file path of adj list property group the property group chunks is aligned with the adj list topology chunks.

Parameters
property_groupproperty group
adj_list_typeadj list type that the property group belongs to
vertex_chunk_indexthe vertex chunk index
edge_chunk_indexindex of edge property group chunk of the vertex chunk

Definition at line 723 of file graph_info.cc.

◆ GetPropertyGroup()

std::shared_ptr< PropertyGroup > graphar::EdgeInfo::GetPropertyGroup ( const std::string &  property) const

Get the property group containing the given property.

Parameters
propertyProperty name.
Returns
Property group may be nullptr if the property is not found.

Definition at line 659 of file graph_info.cc.

◆ GetPropertyGroupByIndex()

std::shared_ptr< PropertyGroup > graphar::EdgeInfo::GetPropertyGroupByIndex ( int  index) const

Get the property group at the specified index.

Parameters
indexThe index of the property group.
Returns
Property group may be nullptr if the index is out of range.

Definition at line 665 of file graph_info.cc.

◆ GetPropertyGroupPathPrefix()

Result< std::string > graphar::EdgeInfo::GetPropertyGroupPathPrefix ( const std::shared_ptr< PropertyGroup > &  property_group,
AdjListType  adj_list_type 
) const

Get the path prefix of the property group chunk for the given adjacency list type.

Parameters
property_groupproperty group.
adj_list_typeThe adjacency list type.
Returns
A Result object containing the path prefix, or a Status object indicating an error.

Definition at line 738 of file graph_info.cc.

◆ GetPropertyType()

Result< std::shared_ptr< DataType > > graphar::EdgeInfo::GetPropertyType ( const std::string &  property_name) const

Get the data type of the specified property.

Parameters
property_nameThe name of the property.
Returns
A Result object containing the data type of the property, or a KeyError Status object if the property is not found.

Definition at line 750 of file graph_info.cc.

◆ GetSrcChunkSize()

IdType graphar::EdgeInfo::GetSrcChunkSize ( ) const

Get the number of source vertices in each vertex chunk.

Returns
The number of source vertices in each vertex chunk.

Definition at line 607 of file graph_info.cc.

◆ GetSrcLabel()

const std::string & graphar::EdgeInfo::GetSrcLabel ( ) const

Get the label of the source vertex.

Returns
The label of the source vertex.

Definition at line 599 of file graph_info.cc.

◆ GetVerticesNumFilePath()

Result< std::string > graphar::EdgeInfo::GetVerticesNumFilePath ( AdjListType  adj_list_type) const

Get the file path for the number of vertices.

Parameters
adj_list_typeThe adjacency list type.
Returns
A Result object containing the file path for the number of edges, or a Status object indicating an error.

Definition at line 673 of file graph_info.cc.

◆ HasAdjacentListType()

bool graphar::EdgeInfo::HasAdjacentListType ( AdjListType  adj_list_type) const

Return whether the edge info contains the adjacency list information.

Parameters
adj_list_typeThe adjacency list type.
Returns
True if the edge info contains the adjacency list information, false otherwise.

Definition at line 619 of file graph_info.cc.

◆ HasProperty()

bool graphar::EdgeInfo::HasProperty ( const std::string &  property_name) const

Returns whether the edge info contains the given property.

Parameters
propertyProperty name to check.
Returns
True if the edge info contains the property, false otherwise.

Definition at line 624 of file graph_info.cc.

◆ IsDirected()

bool graphar::EdgeInfo::IsDirected ( ) const

Returns whether the edge is directed.

Returns
True if the edge is directed, false otherwise.

Definition at line 613 of file graph_info.cc.

◆ IsNullableKey()

bool graphar::EdgeInfo::IsNullableKey ( const std::string &  property_name) const

Returns whether the specified property is a nullable key.

Parameters
property_nameThe name of the property.
Returns
True if the property is a nullable key, False otherwise.

Definition at line 767 of file graph_info.cc.

◆ IsPrimaryKey()

bool graphar::EdgeInfo::IsPrimaryKey ( const std::string &  property_name) const

Returns whether the specified property is a primary key.

Parameters
property_nameThe name of the property.
Returns
True if the property is a primary key, False otherwise.

Definition at line 759 of file graph_info.cc.

◆ IsValidated()

bool graphar::EdgeInfo::IsValidated ( ) const

Returns whether the edge info is validated.

Returns
True if the edge info is valid, False otherwise.

Definition at line 810 of file graph_info.cc.

◆ Load() [1/2]

Result< std::shared_ptr< EdgeInfo > > graphar::EdgeInfo::Load ( const std::string &  input)
static

Loads edge info from a YAML string.

Parameters
inputThe YAML content string.
Returns
A Result object containing the EdgeInfo object, or a Status.

Definition at line 906 of file graph_info.cc.

◆ Load() [2/2]

Result< std::shared_ptr< EdgeInfo > > graphar::EdgeInfo::Load ( std::shared_ptr< Yaml yaml)
static

Loads the yaml as an EdgeInfo instance.

Definition at line 830 of file graph_info.cc.

◆ Save()

Status graphar::EdgeInfo::Save ( const std::string &  file_name) const

Saves the edge info to a YAML file.

Parameters
file_nameThe name of the file to save to.
Returns
A Status object indicating success or failure.

Definition at line 966 of file graph_info.cc.

◆ version()

const std::shared_ptr< const InfoVersion > & graphar::EdgeInfo::version ( ) const

Get the version info of the edge.

Returns
The version info of the edge.

Definition at line 615 of file graph_info.cc.


The documentation for this class was generated from the following files: