Unverified Commit 6c53f351 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

Replace \xxx with @XXX in structured comment. (#4815)



* replace

* more

* file

* change
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 33a2d9e1
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file featgraph/include/featgraph.h * @file featgraph/include/featgraph.h
* \brief FeatGraph kernel headers. * @brief FeatGraph kernel headers.
*/ */
#ifndef FEATGRAPH_H_ #ifndef FEATGRAPH_H_
#define FEATGRAPH_H_ #define FEATGRAPH_H_
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
namespace dgl { namespace dgl {
namespace featgraph { namespace featgraph {
/* \brief Load Featgraph module from given path. */ /* @brief Load Featgraph module from given path. */
void LoadFeatGraphModule(const std::string& path); void LoadFeatGraphModule(const std::string& path);
/* \brief Call Featgraph's SDDMM kernel. */ /* @brief Call Featgraph's SDDMM kernel. */
void SDDMMTreeReduction( void SDDMMTreeReduction(
DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs, DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs,
DLManagedTensor* rhs, DLManagedTensor* out); DLManagedTensor* rhs, DLManagedTensor* out);
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file featgraph/src/featgraph.cc * @file featgraph/src/featgraph.cc
* \brief FeatGraph kernels. * @brief FeatGraph kernels.
*/ */
#include <dmlc/logging.h> #include <dmlc/logging.h>
#include <featgraph.h> #include <featgraph.h>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace dgl { namespace dgl {
namespace featgraph { namespace featgraph {
/* \brief Singleton that loads the featgraph module. */ /* @brief Singleton that loads the featgraph module. */
class FeatGraphModule { class FeatGraphModule {
public: public:
static FeatGraphModule* Global() { static FeatGraphModule* Global() {
...@@ -38,12 +38,12 @@ class FeatGraphModule { ...@@ -38,12 +38,12 @@ class FeatGraphModule {
FeatGraphModule() {} FeatGraphModule() {}
}; };
/* \brief Load Featgraph module from given path. */ /* @brief Load Featgraph module from given path. */
void LoadFeatGraphModule(const std::string& path) { void LoadFeatGraphModule(const std::string& path) {
FeatGraphModule::Global()->Load(path); FeatGraphModule::Global()->Load(path);
} }
/* \brief Convert DLDataType to string. */ /* @brief Convert DLDataType to string. */
inline std::string DTypeAsStr(const DLDataType& t) { inline std::string DTypeAsStr(const DLDataType& t) {
switch (t.code) { switch (t.code) {
case 0U: case 0U:
...@@ -59,14 +59,14 @@ inline std::string DTypeAsStr(const DLDataType& t) { ...@@ -59,14 +59,14 @@ inline std::string DTypeAsStr(const DLDataType& t) {
} }
} }
/* \brief Get operator filename. */ /* @brief Get operator filename. */
inline std::string GetOperatorName( inline std::string GetOperatorName(
const std::string& base_name, const DLDataType& dtype, const std::string& base_name, const DLDataType& dtype,
const DLDataType& idtype) { const DLDataType& idtype) {
return base_name + "_" + DTypeAsStr(dtype) + "_" + DTypeAsStr(idtype); return base_name + "_" + DTypeAsStr(dtype) + "_" + DTypeAsStr(idtype);
} }
/* \brief Call FeatGraph's SDDMM kernel. */ /* @brief Call FeatGraph's SDDMM kernel. */
void SDDMMTreeReduction( void SDDMMTreeReduction(
DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs, DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs,
DLManagedTensor* rhs, DLManagedTensor* out) { DLManagedTensor* rhs, DLManagedTensor* out) {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
/*! /*!
* \brief This is an all in one TVM runtime file. * @brief This is an all in one TVM runtime file.
* *
* You only have to use this file to compile libtvm_runtime to * You only have to use this file to compile libtvm_runtime to
* include in your project. * include in your project.
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/array.h * @file dgl/array.h
* \brief Common array operations required by DGL. * @brief Common array operations required by DGL.
* *
* Note that this is not meant for a full support of array library such as ATen. * Note that this is not meant for a full support of array library such as ATen.
* Only a limited set of operators required by DGL are implemented. * Only a limited set of operators required by DGL are implemented.
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/array_iterator.h * @file dgl/array_iterator.h
* \brief Various iterators. * @brief Various iterators.
*/ */
#ifndef DGL_ARRAY_ITERATOR_H_ #ifndef DGL_ARRAY_ITERATOR_H_
#define DGL_ARRAY_ITERATOR_H_ #define DGL_ARRAY_ITERATOR_H_
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/aten/spmat.h * @file dgl/aten/spmat.h
* \brief Sparse matrix definitions * @brief Sparse matrix definitions
*/ */
#ifndef DGL_ATEN_SPMAT_H_ #ifndef DGL_ATEN_SPMAT_H_
#define DGL_ATEN_SPMAT_H_ #define DGL_ATEN_SPMAT_H_
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
namespace dgl { namespace dgl {
/*! /*!
* \brief Sparse format. * @brief Sparse format.
*/ */
enum class SparseFormat { enum class SparseFormat {
kCOO = 1, kCOO = 1,
...@@ -24,7 +24,7 @@ enum class SparseFormat { ...@@ -24,7 +24,7 @@ enum class SparseFormat {
}; };
/*! /*!
* \brief Sparse format codes * @brief Sparse format codes
*/ */
const dgl_format_code_t ALL_CODE = 0x7; const dgl_format_code_t ALL_CODE = 0x7;
const dgl_format_code_t ANY_CODE = 0x0; const dgl_format_code_t ANY_CODE = 0x0;
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/aten/types.h * @file dgl/aten/types.h
* \brief Array and ID types * @brief Array and ID types
*/ */
#ifndef DGL_ATEN_TYPES_H_ #ifndef DGL_ATEN_TYPES_H_
#define DGL_ATEN_TYPES_H_ #define DGL_ATEN_TYPES_H_
...@@ -14,7 +14,7 @@ namespace dgl { ...@@ -14,7 +14,7 @@ namespace dgl {
typedef uint64_t dgl_id_t; typedef uint64_t dgl_id_t;
typedef uint64_t dgl_type_t; typedef uint64_t dgl_type_t;
/*! \brief Type for dgl fomrat code, whose binary representation indices /*! @brief Type for dgl fomrat code, whose binary representation indices
* which sparse format is in use and which is not. * which sparse format is in use and which is not.
* *
* Suppose the binary representation is xyz, then * Suppose the binary representation is xyz, then
......
/*! /*!
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* \file dgl/heterograph_interface.h * @file dgl/heterograph_interface.h
* \brief DGL heterogeneous graph index class. * @brief DGL heterogeneous graph index class.
*/ */
#ifndef DGL_BASE_HETEROGRAPH_H_ #ifndef DGL_BASE_HETEROGRAPH_H_
...@@ -31,14 +31,14 @@ typedef std::shared_ptr<FlattenedHeteroGraph> FlattenedHeteroGraphPtr; ...@@ -31,14 +31,14 @@ typedef std::shared_ptr<FlattenedHeteroGraph> FlattenedHeteroGraphPtr;
struct HeteroSubgraph; struct HeteroSubgraph;
/*! \brief Enum class for edge direction */ /*! @brief Enum class for edge direction */
enum class EdgeDir { enum class EdgeDir {
kIn, // in edge direction kIn, // in edge direction
kOut // out edge direction kOut // out edge direction
}; };
/*! /*!
* \brief Base heterogenous graph. * @brief Base heterogenous graph.
* *
* In heterograph, nodes represent entities and edges represent relations. * In heterograph, nodes represent entities and edges represent relations.
* Nodes and edges are associated with types. The same pair of entity types * Nodes and edges are associated with types. The same pair of entity types
...@@ -74,63 +74,63 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -74,63 +74,63 @@ class BaseHeteroGraph : public runtime::Object {
virtual GraphPtr meta_graph() const { return meta_graph_; } virtual GraphPtr meta_graph() const { return meta_graph_; }
/*! /*!
* \brief Return the bipartite graph of the given edge type. * @brief Return the bipartite graph of the given edge type.
* \param etype The edge type. * @param etype The edge type.
* \return The bipartite graph. * @return The bipartite graph.
*/ */
virtual HeteroGraphPtr GetRelationGraph(dgl_type_t etype) const = 0; virtual HeteroGraphPtr GetRelationGraph(dgl_type_t etype) const = 0;
///////////////////// query/operations on realized graph ///////////////////// ///////////////////// query/operations on realized graph /////////////////////
/*! \brief Add vertices to the given vertex type */ /*! @brief Add vertices to the given vertex type */
virtual void AddVertices(dgl_type_t vtype, uint64_t num_vertices) = 0; virtual void AddVertices(dgl_type_t vtype, uint64_t num_vertices) = 0;
/*! \brief Add one edge to the given edge type */ /*! @brief Add one edge to the given edge type */
virtual void AddEdge(dgl_type_t etype, dgl_id_t src, dgl_id_t dst) = 0; virtual void AddEdge(dgl_type_t etype, dgl_id_t src, dgl_id_t dst) = 0;
/*! \brief Add edges to the given edge type */ /*! @brief Add edges to the given edge type */
virtual void AddEdges(dgl_type_t etype, IdArray src_ids, IdArray dst_ids) = 0; virtual void AddEdges(dgl_type_t etype, IdArray src_ids, IdArray dst_ids) = 0;
/*! /*!
* \brief Clear the graph. Remove all vertices/edges. * @brief Clear the graph. Remove all vertices/edges.
*/ */
virtual void Clear() = 0; virtual void Clear() = 0;
/*! /*!
* \brief Get the data type of node and edge IDs of this graph. * @brief Get the data type of node and edge IDs of this graph.
*/ */
virtual DGLDataType DataType() const = 0; virtual DGLDataType DataType() const = 0;
/*! /*!
* \brief Get the device context of this graph. * @brief Get the device context of this graph.
*/ */
virtual DGLContext Context() const = 0; virtual DGLContext Context() const = 0;
/*! /*!
* \brief Pin graph. * @brief Pin graph.
*/ */
virtual void PinMemory_() = 0; virtual void PinMemory_() = 0;
/*! /*!
* \brief Check if this graph is pinned. * @brief Check if this graph is pinned.
*/ */
virtual bool IsPinned() const = 0; virtual bool IsPinned() const = 0;
/*! /*!
* \brief Record stream for this graph. * @brief Record stream for this graph.
* \param stream The stream that is using the graph * @param stream The stream that is using the graph
*/ */
virtual void RecordStream(DGLStreamHandle stream) = 0; virtual void RecordStream(DGLStreamHandle stream) = 0;
/*! /*!
* \brief Get the number of integer bits used to store node/edge ids (32 or * @brief Get the number of integer bits used to store node/edge ids (32 or
* 64). * 64).
*/ */
// TODO(BarclayII) replace NumBits() calls to DataType() calls // TODO(BarclayII) replace NumBits() calls to DataType() calls
virtual uint8_t NumBits() const = 0; virtual uint8_t NumBits() const = 0;
/*! /*!
* \return whether the graph is a multigraph * @return whether the graph is a multigraph
*/ */
virtual bool IsMultigraph() const = 0; virtual bool IsMultigraph() const = 0;
...@@ -166,28 +166,28 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -166,28 +166,28 @@ class BaseHeteroGraph : public runtime::Object {
dgl_type_t etype, IdArray src_ids, IdArray dst_ids) const = 0; dgl_type_t etype, IdArray src_ids, IdArray dst_ids) const = 0;
/*! /*!
* \brief Find the predecessors of a vertex. * @brief Find the predecessors of a vertex.
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the predecessor id array. * @return the predecessor id array.
*/ */
virtual IdArray Predecessors(dgl_type_t etype, dgl_id_t dst) const = 0; virtual IdArray Predecessors(dgl_type_t etype, dgl_id_t dst) const = 0;
/*! /*!
* \brief Find the successors of a vertex. * @brief Find the successors of a vertex.
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the successor id array. * @return the successor id array.
*/ */
virtual IdArray Successors(dgl_type_t etype, dgl_id_t src) const = 0; virtual IdArray Successors(dgl_type_t etype, dgl_id_t src) const = 0;
/*! /*!
* \brief Get all edge ids between the two given endpoints * @brief Get all edge ids between the two given endpoints
* \note The given src and dst vertices should belong to the source vertex * @note The given src and dst vertices should belong to the source vertex
* type and the dest vertex type of the given edge type, respectively. \param * type and the dest vertex type of the given edge type, respectively. \param
* etype The edge type \param src The source vertex. \param dst The * etype The edge type \param src The source vertex. \param dst The
* destination vertex. \return the edge id array. * destination vertex. \return the edge id array.
...@@ -196,93 +196,93 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -196,93 +196,93 @@ class BaseHeteroGraph : public runtime::Object {
dgl_type_t etype, dgl_id_t src, dgl_id_t dst) const = 0; dgl_type_t etype, dgl_id_t src, dgl_id_t dst) const = 0;
/*! /*!
* \brief Get all edge ids between the given endpoint pairs. * @brief Get all edge ids between the given endpoint pairs.
* *
* \param etype The edge type * @param etype The edge type
* \param src The src vertex ids. * @param src The src vertex ids.
* \param dst The dst vertex ids. * @param dst The dst vertex ids.
* \return EdgeArray containing all edges between all pairs. * @return EdgeArray containing all edges between all pairs.
*/ */
virtual EdgeArray EdgeIdsAll( virtual EdgeArray EdgeIdsAll(
dgl_type_t etype, IdArray src, IdArray dst) const = 0; dgl_type_t etype, IdArray src, IdArray dst) const = 0;
/*! /*!
* \brief Get edge ids between the given endpoint pairs. * @brief Get edge ids between the given endpoint pairs.
* *
* Only find one matched edge Ids even if there are multiple matches due to * Only find one matched edge Ids even if there are multiple matches due to
* parallel edges. The i^th Id in the returned array is for edge (src[i], * parallel edges. The i^th Id in the returned array is for edge (src[i],
* dst[i]). * dst[i]).
* *
* \param etype The edge type * @param etype The edge type
* \param src The src vertex ids. * @param src The src vertex ids.
* \param dst The dst vertex ids. * @param dst The dst vertex ids.
* \return EdgeArray containing all edges between all pairs. * @return EdgeArray containing all edges between all pairs.
*/ */
virtual IdArray EdgeIdsOne( virtual IdArray EdgeIdsOne(
dgl_type_t etype, IdArray src, IdArray dst) const = 0; dgl_type_t etype, IdArray src, IdArray dst) const = 0;
/*! /*!
* \brief Find the edge ID and return the pair of endpoints * @brief Find the edge ID and return the pair of endpoints
* \param etype The edge type * @param etype The edge type
* \param eid The edge ID * @param eid The edge ID
* \return a pair whose first element is the source and the second the * @return a pair whose first element is the source and the second the
* destination. * destination.
*/ */
virtual std::pair<dgl_id_t, dgl_id_t> FindEdge( virtual std::pair<dgl_id_t, dgl_id_t> FindEdge(
dgl_type_t etype, dgl_id_t eid) const = 0; dgl_type_t etype, dgl_id_t eid) const = 0;
/*! /*!
* \brief Find the edge IDs and return their source and target node IDs. * @brief Find the edge IDs and return their source and target node IDs.
* \param etype The edge type * @param etype The edge type
* \param eids The edge ID array. * @param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is * @return EdgeArray containing all edges with id in eid. The order is
* preserved. * preserved.
*/ */
virtual EdgeArray FindEdges(dgl_type_t etype, IdArray eids) const = 0; virtual EdgeArray FindEdges(dgl_type_t etype, IdArray eids) const = 0;
/*! /*!
* \brief Get the in edges of the vertex. * @brief Get the in edges of the vertex.
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the edges * @return the edges
*/ */
virtual EdgeArray InEdges(dgl_type_t etype, dgl_id_t vid) const = 0; virtual EdgeArray InEdges(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the in edges of the vertices. * @brief Get the in edges of the vertices.
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray InEdges(dgl_type_t etype, IdArray vids) const = 0; virtual EdgeArray InEdges(dgl_type_t etype, IdArray vids) const = 0;
/*! /*!
* \brief Get the out edges of the vertex. * @brief Get the out edges of the vertex.
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray OutEdges(dgl_type_t etype, dgl_id_t vid) const = 0; virtual EdgeArray OutEdges(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the out edges of the vertices. * @brief Get the out edges of the vertices.
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray OutEdges(dgl_type_t etype, IdArray vids) const = 0; virtual EdgeArray OutEdges(dgl_type_t etype, IdArray vids) const = 0;
/*! /*!
* \brief Get all the edges in the graph. * @brief Get all the edges in the graph.
* \note If order is "srcdst", the returned edges list is sorted by their src * @note If order is "srcdst", the returned edges list is sorted by their src
* and dst ids. If order is "eid", they are in their edge id order. Otherwise, * and dst ids. If order is "eid", they are in their edge id order. Otherwise,
* in the arbitrary order. \param etype The edge type \param order The order * in the arbitrary order. \param etype The edge type \param order The order
* of the returned edge list. \return the id arrays of the two endpoints of * of the returned edge list. \return the id arrays of the two endpoints of
...@@ -292,83 +292,83 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -292,83 +292,83 @@ class BaseHeteroGraph : public runtime::Object {
dgl_type_t etype, const std::string& order = "") const = 0; dgl_type_t etype, const std::string& order = "") const = 0;
/*! /*!
* \brief Get the in degree of the given vertex. * @brief Get the in degree of the given vertex.
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the in degree * @return the in degree
*/ */
virtual uint64_t InDegree(dgl_type_t etype, dgl_id_t vid) const = 0; virtual uint64_t InDegree(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the in degrees of the given vertices. * @brief Get the in degrees of the given vertices.
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the in degree array * @return the in degree array
*/ */
virtual DegreeArray InDegrees(dgl_type_t etype, IdArray vids) const = 0; virtual DegreeArray InDegrees(dgl_type_t etype, IdArray vids) const = 0;
/*! /*!
* \brief Get the out degree of the given vertex. * @brief Get the out degree of the given vertex.
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id. * @param vid The vertex id.
* \return the out degree * @return the out degree
*/ */
virtual uint64_t OutDegree(dgl_type_t etype, dgl_id_t vid) const = 0; virtual uint64_t OutDegree(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the out degrees of the given vertices. * @brief Get the out degrees of the given vertices.
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param etype The edge type * @param etype The edge type
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the out degree array * @return the out degree array
*/ */
virtual DegreeArray OutDegrees(dgl_type_t etype, IdArray vids) const = 0; virtual DegreeArray OutDegrees(dgl_type_t etype, IdArray vids) const = 0;
/*! /*!
* \brief Return the successor vector * @brief Return the successor vector
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param vid The vertex id. * @param vid The vertex id.
* \return the successor vector iterator pair. * @return the successor vector iterator pair.
*/ */
virtual DGLIdIters SuccVec(dgl_type_t etype, dgl_id_t vid) const = 0; virtual DGLIdIters SuccVec(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the out edge id vector * @brief Return the out edge id vector
* \note The given vertex should belong to the source vertex type * @note The given vertex should belong to the source vertex type
* of the given edge type. * of the given edge type.
* \param vid The vertex id. * @param vid The vertex id.
* \return the out edge id vector iterator pair. * @return the out edge id vector iterator pair.
*/ */
virtual DGLIdIters OutEdgeVec(dgl_type_t etype, dgl_id_t vid) const = 0; virtual DGLIdIters OutEdgeVec(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the predecessor vector * @brief Return the predecessor vector
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param vid The vertex id. * @param vid The vertex id.
* \return the predecessor vector iterator pair. * @return the predecessor vector iterator pair.
*/ */
virtual DGLIdIters PredVec(dgl_type_t etype, dgl_id_t vid) const = 0; virtual DGLIdIters PredVec(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the in edge id vector * @brief Return the in edge id vector
* \note The given vertex should belong to the dest vertex type * @note The given vertex should belong to the dest vertex type
* of the given edge type. * of the given edge type.
* \param vid The vertex id. * @param vid The vertex id.
* \return the in edge id vector iterator pair. * @return the in edge id vector iterator pair.
*/ */
virtual DGLIdIters InEdgeVec(dgl_type_t etype, dgl_id_t vid) const = 0; virtual DGLIdIters InEdgeVec(dgl_type_t etype, dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the adjacency matrix of the graph. * @brief Get the adjacency matrix of the graph.
* *
* TODO(minjie): deprecate this interface; replace it with GetXXXMatrix. * TODO(minjie): deprecate this interface; replace it with GetXXXMatrix.
* *
...@@ -381,113 +381,113 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -381,113 +381,113 @@ class BaseHeteroGraph : public runtime::Object {
* If the fmt is 'coo', the function should return one array of shape (2, * If the fmt is 'coo', the function should return one array of shape (2,
* nnz), representing a horitonzal stack of row and col indices. * nnz), representing a horitonzal stack of row and col indices.
* *
* \param transpose A flag to transpose the returned adjacency matrix. * @param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix. * @param fmt the format of the returned adjacency matrix.
* \return a vector of IdArrays. * @return a vector of IdArrays.
*/ */
virtual std::vector<IdArray> GetAdj( virtual std::vector<IdArray> GetAdj(
dgl_type_t etype, bool transpose, const std::string& fmt) const = 0; dgl_type_t etype, bool transpose, const std::string& fmt) const = 0;
/*! /*!
* \brief Determine which format to use with a preference. * @brief Determine which format to use with a preference.
* *
* Otherwise, it will return whatever DGL thinks is the most appropriate given * Otherwise, it will return whatever DGL thinks is the most appropriate given
* the arguments. * the arguments.
* *
* \param etype Edge type. * @param etype Edge type.
* \param preferred_formats Preferred sparse formats. * @param preferred_formats Preferred sparse formats.
* \return Available sparse format. * @return Available sparse format.
*/ */
virtual SparseFormat SelectFormat( virtual SparseFormat SelectFormat(
dgl_type_t etype, dgl_format_code_t preferred_formats) const = 0; dgl_type_t etype, dgl_format_code_t preferred_formats) const = 0;
/*! /*!
* \brief Return sparse formats already created for the graph. * @brief Return sparse formats already created for the graph.
* *
* \return a number of type dgl_format_code_t. * @return a number of type dgl_format_code_t.
*/ */
virtual dgl_format_code_t GetCreatedFormats() const = 0; virtual dgl_format_code_t GetCreatedFormats() const = 0;
/*! /*!
* \brief Return allowed sparse formats for the graph. * @brief Return allowed sparse formats for the graph.
* *
* \return a number of type dgl_format_code_t. * @return a number of type dgl_format_code_t.
*/ */
virtual dgl_format_code_t GetAllowedFormats() const = 0; virtual dgl_format_code_t GetAllowedFormats() const = 0;
/*! /*!
* \brief Return the graph in specified available formats. * @brief Return the graph in specified available formats.
* *
* \return The new graph. * @return The new graph.
*/ */
virtual HeteroGraphPtr GetGraphInFormat(dgl_format_code_t formats) const = 0; virtual HeteroGraphPtr GetGraphInFormat(dgl_format_code_t formats) const = 0;
/*! /*!
* \brief Get adjacency matrix in COO format. * @brief Get adjacency matrix in COO format.
* \param etype Edge type. * @param etype Edge type.
* \return COO matrix. * @return COO matrix.
*/ */
virtual aten::COOMatrix GetCOOMatrix(dgl_type_t etype) const = 0; virtual aten::COOMatrix GetCOOMatrix(dgl_type_t etype) const = 0;
/*! /*!
* \brief Get adjacency matrix in CSR format. * @brief Get adjacency matrix in CSR format.
* *
* The row and column sizes are equal to the number of dsttype and srctype * The row and column sizes are equal to the number of dsttype and srctype
* nodes, respectively. * nodes, respectively.
* *
* \param etype Edge type. * @param etype Edge type.
* \return CSR matrix. * @return CSR matrix.
*/ */
virtual aten::CSRMatrix GetCSRMatrix(dgl_type_t etype) const = 0; virtual aten::CSRMatrix GetCSRMatrix(dgl_type_t etype) const = 0;
/*! /*!
* \brief Get adjacency matrix in CSC format. * @brief Get adjacency matrix in CSC format.
* *
* A CSC matrix is equivalent to the transpose of a CSR matrix. * A CSC matrix is equivalent to the transpose of a CSR matrix.
* We reuse the CSRMatrix data structure as return value. The row and column * We reuse the CSRMatrix data structure as return value. The row and column
* sizes are equal to the number of dsttype and srctype nodes, respectively. * sizes are equal to the number of dsttype and srctype nodes, respectively.
* *
* \param etype Edge type. * @param etype Edge type.
* \return A CSR matrix. * @return A CSR matrix.
*/ */
virtual aten::CSRMatrix GetCSCMatrix(dgl_type_t etype) const = 0; virtual aten::CSRMatrix GetCSCMatrix(dgl_type_t etype) const = 0;
/*! /*!
* \brief Extract the induced subgraph by the given vertices. * @brief Extract the induced subgraph by the given vertices.
* *
* The length of the given vector should be equal to the number of vertex * The length of the given vector should be equal to the number of vertex
* types. Empty arrays can be provided if no vertex is needed for the type. * types. Empty arrays can be provided if no vertex is needed for the type.
* The result subgraph has the same meta graph with the parent, but some types * The result subgraph has the same meta graph with the parent, but some types
* can have no node/edge. * can have no node/edge.
* *
* \param vids the induced vertices per type. * @param vids the induced vertices per type.
* \return the subgraph. * @return the subgraph.
*/ */
virtual HeteroSubgraph VertexSubgraph( virtual HeteroSubgraph VertexSubgraph(
const std::vector<IdArray>& vids) const = 0; const std::vector<IdArray>& vids) const = 0;
/*! /*!
* \brief Extract the induced subgraph by the given edges. * @brief Extract the induced subgraph by the given edges.
* *
* The length of the given vector should be equal to the number of edge types. * The length of the given vector should be equal to the number of edge types.
* Empty arrays can be provided if no edge is needed for the type. The result * Empty arrays can be provided if no edge is needed for the type. The result
* subgraph has the same meta graph with the parent, but some types can have * subgraph has the same meta graph with the parent, but some types can have
* no node/edge. * no node/edge.
* *
* \param eids The edges in the subgraph. * @param eids The edges in the subgraph.
* \param preserve_nodes If true, the vertices will not be relabeled, so some * @param preserve_nodes If true, the vertices will not be relabeled, so some
* vertices may have no incident edges. \return the subgraph. * vertices may have no incident edges. \return the subgraph.
*/ */
virtual HeteroSubgraph EdgeSubgraph( virtual HeteroSubgraph EdgeSubgraph(
const std::vector<IdArray>& eids, bool preserve_nodes = false) const = 0; const std::vector<IdArray>& eids, bool preserve_nodes = false) const = 0;
/*! /*!
* \brief Convert the list of requested unitgraph graphs into a single * @brief Convert the list of requested unitgraph graphs into a single
* unitgraph graph. * unitgraph graph.
* *
* \param etypes The list of edge type IDs. * @param etypes The list of edge type IDs.
* \return The flattened graph, with induced source/edge/destination * @return The flattened graph, with induced source/edge/destination
* types/IDs. * types/IDs.
*/ */
virtual FlattenedHeteroGraphPtr Flatten( virtual FlattenedHeteroGraphPtr Flatten(
...@@ -496,7 +496,7 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -496,7 +496,7 @@ class BaseHeteroGraph : public runtime::Object {
return nullptr; return nullptr;
} }
/*! \brief Cast this graph to immutable graph */ /*! @brief Cast this graph to immutable graph */
virtual GraphPtr AsImmutableGraph() const { virtual GraphPtr AsImmutableGraph() const {
LOG(FATAL) << "AsImmutableGraph not supported."; LOG(FATAL) << "AsImmutableGraph not supported.";
return nullptr; return nullptr;
...@@ -506,7 +506,7 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -506,7 +506,7 @@ class BaseHeteroGraph : public runtime::Object {
DGL_DECLARE_OBJECT_TYPE_INFO(BaseHeteroGraph, runtime::Object); DGL_DECLARE_OBJECT_TYPE_INFO(BaseHeteroGraph, runtime::Object);
protected: protected:
/*! \brief meta graph */ /*! @brief meta graph */
GraphPtr meta_graph_; GraphPtr meta_graph_;
// empty constructor // empty constructor
...@@ -517,7 +517,7 @@ class BaseHeteroGraph : public runtime::Object { ...@@ -517,7 +517,7 @@ class BaseHeteroGraph : public runtime::Object {
DGL_DEFINE_OBJECT_REF(HeteroGraphRef, BaseHeteroGraph); DGL_DEFINE_OBJECT_REF(HeteroGraphRef, BaseHeteroGraph);
/*! /*!
* \brief Hetero-subgraph data structure. * @brief Hetero-subgraph data structure.
* *
* This class can be used as arguments and return values of a C API. * This class can be used as arguments and return values of a C API.
* *
...@@ -531,17 +531,17 @@ DGL_DEFINE_OBJECT_REF(HeteroGraphRef, BaseHeteroGraph); ...@@ -531,17 +531,17 @@ DGL_DEFINE_OBJECT_REF(HeteroGraphRef, BaseHeteroGraph);
* </code> * </code>
*/ */
struct HeteroSubgraph : public runtime::Object { struct HeteroSubgraph : public runtime::Object {
/*! \brief The heterograph. */ /*! @brief The heterograph. */
HeteroGraphPtr graph; HeteroGraphPtr graph;
/*! /*!
* \brief The induced vertex ids of each entity type. * @brief The induced vertex ids of each entity type.
* The vector length is equal to the number of vertex types in the parent * The vector length is equal to the number of vertex types in the parent
* graph. Each array i has the same length as the number of vertices in type * graph. Each array i has the same length as the number of vertices in type
* i. Empty array is allowed if the mapping is identity. * i. Empty array is allowed if the mapping is identity.
*/ */
std::vector<IdArray> induced_vertices; std::vector<IdArray> induced_vertices;
/*! /*!
* \brief The induced edge ids of each relation type. * @brief The induced edge ids of each relation type.
* The vector length is equal to the number of edge types in the parent graph. * The vector length is equal to the number of edge types in the parent graph.
* Each array i has the same length as the number of edges in type i. * Each array i has the same length as the number of edges in type i.
* Empty array is allowed if the mapping is identity. * Empty array is allowed if the mapping is identity.
...@@ -555,46 +555,46 @@ struct HeteroSubgraph : public runtime::Object { ...@@ -555,46 +555,46 @@ struct HeteroSubgraph : public runtime::Object {
// Define HeteroSubgraphRef // Define HeteroSubgraphRef
DGL_DEFINE_OBJECT_REF(HeteroSubgraphRef, HeteroSubgraph); DGL_DEFINE_OBJECT_REF(HeteroSubgraphRef, HeteroSubgraph);
/*! \brief The flattened heterograph */ /*! @brief The flattened heterograph */
struct FlattenedHeteroGraph : public runtime::Object { struct FlattenedHeteroGraph : public runtime::Object {
/*! \brief The graph */ /*! @brief The graph */
HeteroGraphRef graph; HeteroGraphRef graph;
/*! /*!
* \brief Mapping from source node ID to node type in parent graph * @brief Mapping from source node ID to node type in parent graph
* \note The induced type array guarantees that the same type always appear * @note The induced type array guarantees that the same type always appear
* contiguously. * contiguously.
*/ */
IdArray induced_srctype; IdArray induced_srctype;
/*! /*!
* \brief The set of node types in parent graph appearing in source nodes. * @brief The set of node types in parent graph appearing in source nodes.
*/ */
IdArray induced_srctype_set; IdArray induced_srctype_set;
/*! \brief Mapping from source node ID to local node ID in parent graph */ /*! @brief Mapping from source node ID to local node ID in parent graph */
IdArray induced_srcid; IdArray induced_srcid;
/*! /*!
* \brief Mapping from edge ID to edge type in parent graph * @brief Mapping from edge ID to edge type in parent graph
* \note The induced type array guarantees that the same type always appear * @note The induced type array guarantees that the same type always appear
* contiguously. * contiguously.
*/ */
IdArray induced_etype; IdArray induced_etype;
/*! /*!
* \brief The set of edge types in parent graph appearing in edges. * @brief The set of edge types in parent graph appearing in edges.
*/ */
IdArray induced_etype_set; IdArray induced_etype_set;
/*! \brief Mapping from edge ID to local edge ID in parent graph */ /*! @brief Mapping from edge ID to local edge ID in parent graph */
IdArray induced_eid; IdArray induced_eid;
/*! /*!
* \brief Mapping from destination node ID to node type in parent graph * @brief Mapping from destination node ID to node type in parent graph
* \note The induced type array guarantees that the same type always appear * @note The induced type array guarantees that the same type always appear
* contiguously. * contiguously.
*/ */
IdArray induced_dsttype; IdArray induced_dsttype;
/*! /*!
* \brief The set of node types in parent graph appearing in destination * @brief The set of node types in parent graph appearing in destination
* nodes. * nodes.
*/ */
IdArray induced_dsttype_set; IdArray induced_dsttype_set;
/*! \brief Mapping from destination node ID to local node ID in parent graph /*! @brief Mapping from destination node ID to local node ID in parent graph
*/ */
IdArray induced_dstid; IdArray induced_dstid;
...@@ -619,7 +619,7 @@ DGL_DEFINE_OBJECT_REF(FlattenedHeteroGraphRef, FlattenedHeteroGraph); ...@@ -619,7 +619,7 @@ DGL_DEFINE_OBJECT_REF(FlattenedHeteroGraphRef, FlattenedHeteroGraph);
// Declarations of functions and algorithms // Declarations of functions and algorithms
/*! /*!
* \brief Create a heterograph from meta graph and a list of bipartite graph, * @brief Create a heterograph from meta graph and a list of bipartite graph,
* additionally specifying number of nodes per type. * additionally specifying number of nodes per type.
*/ */
HeteroGraphPtr CreateHeteroGraph( HeteroGraphPtr CreateHeteroGraph(
...@@ -627,18 +627,18 @@ HeteroGraphPtr CreateHeteroGraph( ...@@ -627,18 +627,18 @@ HeteroGraphPtr CreateHeteroGraph(
const std::vector<int64_t>& num_nodes_per_type = {}); const std::vector<int64_t>& num_nodes_per_type = {});
/*! /*!
* \brief Create a heterograph from COO input. * @brief Create a heterograph from COO input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param num_src Number of nodes in the source type. * @param num_src Number of nodes in the source type.
* \param num_dst Number of nodes in the destination type. * @param num_dst Number of nodes in the destination type.
* \param row Src node ids of the edges. * @param row Src node ids of the edges.
* \param col Dst node ids of the edges. * @param col Dst node ids of the edges.
* \param row_sorted Whether the `row` array is in sorted ascending order. * @param row_sorted Whether the `row` array is in sorted ascending order.
* \param col_sorted When `row_sorted` is true, whether the columns within each * @param col_sorted When `row_sorted` is true, whether the columns within each
* row are also sorted. When `row_sorted` is false, this flag must also be * row are also sorted. When `row_sorted` is false, this flag must also be
* false. * false.
* \param formats Sparse formats used for storing this graph. * @param formats Sparse formats used for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCOO( HeteroGraphPtr CreateFromCOO(
int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray row, int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray row,
...@@ -646,73 +646,73 @@ HeteroGraphPtr CreateFromCOO( ...@@ -646,73 +646,73 @@ HeteroGraphPtr CreateFromCOO(
dgl_format_code_t formats = ALL_CODE); dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Create a heterograph from COO input. * @brief Create a heterograph from COO input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param mat The COO matrix * @param mat The COO matrix
* \param formats Sparse formats used for storing this graph. * @param formats Sparse formats used for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCOO( HeteroGraphPtr CreateFromCOO(
int64_t num_vtypes, const aten::COOMatrix& mat, int64_t num_vtypes, const aten::COOMatrix& mat,
dgl_format_code_t formats = ALL_CODE); dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Create a heterograph from CSR input. * @brief Create a heterograph from CSR input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param num_src Number of nodes in the source type. * @param num_src Number of nodes in the source type.
* \param num_dst Number of nodes in the destination type. * @param num_dst Number of nodes in the destination type.
* \param indptr Indptr array * @param indptr Indptr array
* \param indices Indices array * @param indices Indices array
* \param edge_ids Edge ids * @param edge_ids Edge ids
* \param formats Sparse formats for storing this graph. * @param formats Sparse formats for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCSR( HeteroGraphPtr CreateFromCSR(
int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray indptr, int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray indptr,
IdArray indices, IdArray edge_ids, dgl_format_code_t formats = ALL_CODE); IdArray indices, IdArray edge_ids, dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Create a heterograph from CSR input. * @brief Create a heterograph from CSR input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param mat The CSR matrix * @param mat The CSR matrix
* \param formats Sparse formats for storing this graph. * @param formats Sparse formats for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCSR( HeteroGraphPtr CreateFromCSR(
int64_t num_vtypes, const aten::CSRMatrix& mat, int64_t num_vtypes, const aten::CSRMatrix& mat,
dgl_format_code_t formats = ALL_CODE); dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Create a heterograph from CSC input. * @brief Create a heterograph from CSC input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param num_src Number of nodes in the source type. * @param num_src Number of nodes in the source type.
* \param num_dst Number of nodes in the destination type. * @param num_dst Number of nodes in the destination type.
* \param indptr Indptr array * @param indptr Indptr array
* \param indices Indices array * @param indices Indices array
* \param edge_ids Edge ids * @param edge_ids Edge ids
* \param formats Sparse formats used for storing this graph. * @param formats Sparse formats used for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCSC( HeteroGraphPtr CreateFromCSC(
int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray indptr, int64_t num_vtypes, int64_t num_src, int64_t num_dst, IdArray indptr,
IdArray indices, IdArray edge_ids, dgl_format_code_t formats = ALL_CODE); IdArray indices, IdArray edge_ids, dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Create a heterograph from CSC input. * @brief Create a heterograph from CSC input.
* \param num_vtypes Number of vertex types. Must be 1 or 2. * @param num_vtypes Number of vertex types. Must be 1 or 2.
* \param mat The CSC matrix * @param mat The CSC matrix
* \param formats Sparse formats available for storing this graph. * @param formats Sparse formats available for storing this graph.
* \return A heterograph pointer. * @return A heterograph pointer.
*/ */
HeteroGraphPtr CreateFromCSC( HeteroGraphPtr CreateFromCSC(
int64_t num_vtypes, const aten::CSRMatrix& mat, int64_t num_vtypes, const aten::CSRMatrix& mat,
dgl_format_code_t formats = ALL_CODE); dgl_format_code_t formats = ALL_CODE);
/*! /*!
* \brief Extract the subgraph of the in edges of the given nodes. * @brief Extract the subgraph of the in edges of the given nodes.
* \param graph Graph * @param graph Graph
* \param nodes Node IDs of each type * @param nodes Node IDs of each type
* \param relabel_nodes Whether to remove isolated nodes and relabel the rest * @param relabel_nodes Whether to remove isolated nodes and relabel the rest
* ones \return Subgraph containing only the in edges. The returned graph has * ones \return Subgraph containing only the in edges. The returned graph has
* the same schema as the original one. * the same schema as the original one.
*/ */
...@@ -721,10 +721,10 @@ HeteroSubgraph InEdgeGraph( ...@@ -721,10 +721,10 @@ HeteroSubgraph InEdgeGraph(
bool relabel_nodes = false); bool relabel_nodes = false);
/*! /*!
* \brief Extract the subgraph of the out edges of the given nodes. * @brief Extract the subgraph of the out edges of the given nodes.
* \param graph Graph * @param graph Graph
* \param nodes Node IDs of each type * @param nodes Node IDs of each type
* \param relabel_nodes Whether to remove isolated nodes and relabel the rest * @param relabel_nodes Whether to remove isolated nodes and relabel the rest
* ones \return Subgraph containing only the out edges. The returned graph has * ones \return Subgraph containing only the out edges. The returned graph has
* the same schema as the original one. * the same schema as the original one.
*/ */
...@@ -733,31 +733,31 @@ HeteroSubgraph OutEdgeGraph( ...@@ -733,31 +733,31 @@ HeteroSubgraph OutEdgeGraph(
bool relabel_nodes = false); bool relabel_nodes = false);
/*! /*!
* \brief Joint union multiple graphs into one graph. * @brief Joint union multiple graphs into one graph.
* *
* All input graphs should have the same metagraph. * All input graphs should have the same metagraph.
* *
* TODO(xiangsx): remove the meta_graph argument * TODO(xiangsx): remove the meta_graph argument
* *
* \param meta_graph Metagraph of the inputs and result. * @param meta_graph Metagraph of the inputs and result.
* \param component_graphs Input graphs * @param component_graphs Input graphs
* \return One graph that unions all the components * @return One graph that unions all the components
*/ */
HeteroGraphPtr JointUnionHeteroGraph( HeteroGraphPtr JointUnionHeteroGraph(
GraphPtr meta_graph, const std::vector<HeteroGraphPtr>& component_graphs); GraphPtr meta_graph, const std::vector<HeteroGraphPtr>& component_graphs);
/*! /*!
* \brief Union multiple graphs into one with each input graph as one disjoint * @brief Union multiple graphs into one with each input graph as one disjoint
* component. * component.
* *
* All input graphs should have the same metagraph. * All input graphs should have the same metagraph.
* *
* TODO(minjie): remove the meta_graph argument * TODO(minjie): remove the meta_graph argument
* *
* \tparam IdType Graph's index data type, can be int32_t or int64_t * @tparam IdType Graph's index data type, can be int32_t or int64_t
* \param meta_graph Metagraph of the inputs and result. * @param meta_graph Metagraph of the inputs and result.
* \param component_graphs Input graphs * @param component_graphs Input graphs
* \return One graph that unions all the components * @return One graph that unions all the components
*/ */
template <class IdType> template <class IdType>
HeteroGraphPtr DisjointUnionHeteroGraph( HeteroGraphPtr DisjointUnionHeteroGraph(
...@@ -767,18 +767,18 @@ HeteroGraphPtr DisjointUnionHeteroGraph2( ...@@ -767,18 +767,18 @@ HeteroGraphPtr DisjointUnionHeteroGraph2(
GraphPtr meta_graph, const std::vector<HeteroGraphPtr>& component_graphs); GraphPtr meta_graph, const std::vector<HeteroGraphPtr>& component_graphs);
/*! /*!
* \brief Slice a contiguous subgraph, e.g. retrieve a component graph from a * @brief Slice a contiguous subgraph, e.g. retrieve a component graph from a
* batched graph. * batched graph.
* *
* TODO(mufei): remove the meta_graph argument * TODO(mufei): remove the meta_graph argument
* *
* \param meta_graph Metagraph of the input and result. * @param meta_graph Metagraph of the input and result.
* \param batched_graph Input graph. * @param batched_graph Input graph.
* \param num_nodes_per_type Number of vertices of each type in the result. * @param num_nodes_per_type Number of vertices of each type in the result.
* \param start_nid_per_type Start vertex ID of each type to slice. * @param start_nid_per_type Start vertex ID of each type to slice.
* \param num_edges_per_type Number of edges of each type in the result. * @param num_edges_per_type Number of edges of each type in the result.
* \param start_eid_per_type Start edge ID of each type to slice. * @param start_eid_per_type Start edge ID of each type to slice.
* \return Sliced graph * @return Sliced graph
*/ */
HeteroGraphPtr SliceHeteroGraph( HeteroGraphPtr SliceHeteroGraph(
GraphPtr meta_graph, HeteroGraphPtr batched_graph, GraphPtr meta_graph, HeteroGraphPtr batched_graph,
...@@ -786,7 +786,7 @@ HeteroGraphPtr SliceHeteroGraph( ...@@ -786,7 +786,7 @@ HeteroGraphPtr SliceHeteroGraph(
IdArray num_edges_per_type, IdArray start_eid_per_type); IdArray num_edges_per_type, IdArray start_eid_per_type);
/*! /*!
* \brief Split a graph into multiple disjoin components. * @brief Split a graph into multiple disjoin components.
* *
* Edges across different components are ignored. All the result graphs have the * Edges across different components are ignored. All the result graphs have the
* same metagraph as the input one. * same metagraph as the input one.
...@@ -798,12 +798,12 @@ HeteroGraphPtr SliceHeteroGraph( ...@@ -798,12 +798,12 @@ HeteroGraphPtr SliceHeteroGraph(
* TODO(minjie): remove the meta_graph argument; use vector<IdArray> for * TODO(minjie): remove the meta_graph argument; use vector<IdArray> for
* vertex_sizes and edge_sizes. * vertex_sizes and edge_sizes.
* *
* \tparam IdType Graph's index data type, can be int32_t or int64_t * @tparam IdType Graph's index data type, can be int32_t or int64_t
* \param meta_graph Metagraph. * @param meta_graph Metagraph.
* \param batched_graph Input graph. * @param batched_graph Input graph.
* \param vertex_sizes Number of vertices of each component. * @param vertex_sizes Number of vertices of each component.
* \param edge_sizes Number of vertices of each component. * @param edge_sizes Number of vertices of each component.
* \return A list of graphs representing each disjoint components. * @return A list of graphs representing each disjoint components.
*/ */
template <class IdType> template <class IdType>
std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes( std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes(
...@@ -815,7 +815,7 @@ std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes2( ...@@ -815,7 +815,7 @@ std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes2(
IdArray edge_sizes); IdArray edge_sizes);
/*! /*!
* \brief Structure for pickle/unpickle. * @brief Structure for pickle/unpickle.
* *
* The design principle is to leverage the NDArray class as much as possible so * The design principle is to leverage the NDArray class as much as possible so
* that when they are converted to backend-specific tensors, we could leverage * that when they are converted to backend-specific tensors, we could leverage
...@@ -827,29 +827,29 @@ std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes2( ...@@ -827,29 +827,29 @@ std::vector<HeteroGraphPtr> DisjointPartitionHeteroBySizes2(
* This class can be used as arguments and return values of a C API. * This class can be used as arguments and return values of a C API.
*/ */
struct HeteroPickleStates : public runtime::Object { struct HeteroPickleStates : public runtime::Object {
/*! \brief version number */ /*! @brief version number */
int64_t version = 0; int64_t version = 0;
/*! \brief Metainformation /*! @brief Metainformation
* *
* metagraph, number of nodes per type, format, flags * metagraph, number of nodes per type, format, flags
*/ */
std::string meta; std::string meta;
/*! \brief Arrays representing graph structure (coo or csr) */ /*! @brief Arrays representing graph structure (coo or csr) */
std::vector<IdArray> arrays; std::vector<IdArray> arrays;
/* To support backward compatibility, we have to retain fields in the old /* To support backward compatibility, we have to retain fields in the old
* version of HeteroPickleStates * version of HeteroPickleStates
*/ */
/*! \brief Metagraph(64bits ImmutableGraph) */ /*! @brief Metagraph(64bits ImmutableGraph) */
GraphPtr metagraph; GraphPtr metagraph;
/*! \brief Number of nodes per type */ /*! @brief Number of nodes per type */
std::vector<int64_t> num_nodes_per_type; std::vector<int64_t> num_nodes_per_type;
/*! \brief adjacency matrices of each relation graph */ /*! @brief adjacency matrices of each relation graph */
std::vector<std::shared_ptr<SparseMatrix> > adjs; std::vector<std::shared_ptr<SparseMatrix> > adjs;
static constexpr const char* _type_key = "graph.HeteroPickleStates"; static constexpr const char* _type_key = "graph.HeteroPickleStates";
...@@ -860,31 +860,31 @@ struct HeteroPickleStates : public runtime::Object { ...@@ -860,31 +860,31 @@ struct HeteroPickleStates : public runtime::Object {
DGL_DEFINE_OBJECT_REF(HeteroPickleStatesRef, HeteroPickleStates); DGL_DEFINE_OBJECT_REF(HeteroPickleStatesRef, HeteroPickleStates);
/*! /*!
* \brief Create a heterograph from pickling states. * @brief Create a heterograph from pickling states.
* *
* \param states Pickle states * @param states Pickle states
* \return A heterograph pointer * @return A heterograph pointer
*/ */
HeteroGraphPtr HeteroUnpickle(const HeteroPickleStates& states); HeteroGraphPtr HeteroUnpickle(const HeteroPickleStates& states);
/*! /*!
* \brief Get the pickling state of the relation graph structure in backend * @brief Get the pickling state of the relation graph structure in backend
* tensors. * tensors.
* *
* \return a HeteroPickleStates object * @return a HeteroPickleStates object
*/ */
HeteroPickleStates HeteroPickle(HeteroGraphPtr graph); HeteroPickleStates HeteroPickle(HeteroGraphPtr graph);
/*! /*!
* \brief Old version of HeteroUnpickle, for backward compatibility * @brief Old version of HeteroUnpickle, for backward compatibility
* *
* \param states Pickle states * @param states Pickle states
* \return A heterograph pointer * @return A heterograph pointer
*/ */
HeteroGraphPtr HeteroUnpickleOld(const HeteroPickleStates& states); HeteroGraphPtr HeteroUnpickleOld(const HeteroPickleStates& states);
/*! /*!
* \brief Create heterograph from pickling states pickled by ForkingPickler. * @brief Create heterograph from pickling states pickled by ForkingPickler.
* *
* This is different from HeteroUnpickle where * This is different from HeteroUnpickle where
* (1) Backward compatibility is not required, * (1) Backward compatibility is not required,
...@@ -893,7 +893,7 @@ HeteroGraphPtr HeteroUnpickleOld(const HeteroPickleStates& states); ...@@ -893,7 +893,7 @@ HeteroGraphPtr HeteroUnpickleOld(const HeteroPickleStates& states);
HeteroGraphPtr HeteroForkingUnpickle(const HeteroPickleStates& states); HeteroGraphPtr HeteroForkingUnpickle(const HeteroPickleStates& states);
/*! /*!
* \brief Get the pickling states of the relation graph structure in backend * @brief Get the pickling states of the relation graph structure in backend
* tensors for ForkingPickler. * tensors for ForkingPickler.
* *
* This is different from HeteroPickle where * This is different from HeteroPickle where
......
/*! /*!
* Copyright (c) 2020 by Contributors * \file dgl/aten/bcast.h * Copyright (c) 2020 by Contributors
* \brief Broadcast related function C++ header. * @file dgl/aten/bcast.h
* @brief Broadcast related function C++ header.
*/ */
#ifndef DGL_BCAST_H_ #ifndef DGL_BCAST_H_
#define DGL_BCAST_H_ #define DGL_BCAST_H_
...@@ -14,12 +15,12 @@ using namespace dgl::runtime; ...@@ -14,12 +15,12 @@ using namespace dgl::runtime;
namespace dgl { namespace dgl {
/*! /*!
* \brief Broadcast offsets and auxiliary information. * @brief Broadcast offsets and auxiliary information.
*/ */
struct BcastOff { struct BcastOff {
/*! /*!
* \brief offset vector of lhs operand and rhs operand. * @brief offset vector of lhs operand and rhs operand.
* \note lhs_offset[i] indicates the start position of the scalar * @note lhs_offset[i] indicates the start position of the scalar
* in lhs operand that required to compute the i-th element * in lhs operand that required to compute the i-th element
* in the output, likewise for rhs_offset. * in the output, likewise for rhs_offset.
* *
...@@ -35,11 +36,11 @@ struct BcastOff { ...@@ -35,11 +36,11 @@ struct BcastOff {
* rhs array. * rhs array.
*/ */
std::vector<int64_t> lhs_offset, rhs_offset; std::vector<int64_t> lhs_offset, rhs_offset;
/*! \brief Whether broadcast is required or not. */ /*! @brief Whether broadcast is required or not. */
bool use_bcast; bool use_bcast;
/*! /*!
* \brief Auxiliary information for kernel computation * @brief Auxiliary information for kernel computation
* \note lhs_len refers to the left hand side operand length. * @note lhs_len refers to the left hand side operand length.
* e.g. 15 for shape (1, 3, 5) * e.g. 15 for shape (1, 3, 5)
* rhs_len refers to the right hand side operand length. * rhs_len refers to the right hand side operand length.
* e.g. 15 for shape (3, 1, 5) * e.g. 15 for shape (3, 1, 5)
...@@ -52,13 +53,13 @@ struct BcastOff { ...@@ -52,13 +53,13 @@ struct BcastOff {
}; };
/*! /*!
* \brief: Compute broadcast and auxiliary information given operator * @brief: Compute broadcast and auxiliary information given operator
* and operands for kernel computation. * and operands for kernel computation.
* \param op: a string indicates the operator, could be `add`, `sub`, * @param op: a string indicates the operator, could be `add`, `sub`,
* `mul`, `div`, `dot`, 'copy_u`, `copy_e`. * `mul`, `div`, `dot`, 'copy_u`, `copy_e`.
* \param lhs The left hand side operand of NDArray class. * @param lhs The left hand side operand of NDArray class.
* \param rhs The right hand side operand of NDArray class. * @param rhs The right hand side operand of NDArray class.
* \return the broadcast information of BcastOff class. * @return the broadcast information of BcastOff class.
*/ */
BcastOff CalcBcastOff(const std::string& op, NDArray lhs, NDArray rhs); BcastOff CalcBcastOff(const std::string& op, NDArray lhs, NDArray rhs);
......
/*! /*!
* Copyright (c) 2018 by Contributors * Copyright (c) 2018 by Contributors
* \file dgl/graph.h * @file dgl/graph.h
* \brief DGL graph index class. * @brief DGL graph index class.
*/ */
#ifndef DGL_GRAPH_H_ #ifndef DGL_GRAPH_H_
#define DGL_GRAPH_H_ #define DGL_GRAPH_H_
...@@ -21,20 +21,20 @@ class Graph; ...@@ -21,20 +21,20 @@ class Graph;
class GraphOp; class GraphOp;
typedef std::shared_ptr<Graph> MutableGraphPtr; typedef std::shared_ptr<Graph> MutableGraphPtr;
/*! \brief Mutable graph based on adjacency list. */ /*! @brief Mutable graph based on adjacency list. */
class Graph : public GraphInterface { class Graph : public GraphInterface {
public: public:
/*! \brief default constructor */ /*! @brief default constructor */
Graph() {} Graph() {}
/*! \brief construct a graph from the coo format. */ /*! @brief construct a graph from the coo format. */
Graph(IdArray src_ids, IdArray dst_ids, size_t num_nodes); Graph(IdArray src_ids, IdArray dst_ids, size_t num_nodes);
/*! \brief default copy constructor */ /*! @brief default copy constructor */
Graph(const Graph& other) = default; Graph(const Graph& other) = default;
#ifndef _MSC_VER #ifndef _MSC_VER
/*! \brief default move constructor */ /*! @brief default move constructor */
Graph(Graph&& other) = default; Graph(Graph&& other) = default;
#else #else
Graph(Graph&& other) { Graph(Graph&& other) {
...@@ -48,36 +48,36 @@ class Graph : public GraphInterface { ...@@ -48,36 +48,36 @@ class Graph : public GraphInterface {
} }
#endif // _MSC_VER #endif // _MSC_VER
/*! \brief default assign constructor */ /*! @brief default assign constructor */
Graph& operator=(const Graph& other) = default; Graph& operator=(const Graph& other) = default;
/*! \brief default destructor */ /*! @brief default destructor */
~Graph() = default; ~Graph() = default;
/*! /*!
* \brief Add vertices to the graph. * @brief Add vertices to the graph.
* \note Since vertices are integers enumerated from zero, only the number of * @note Since vertices are integers enumerated from zero, only the number of
* vertices to be added needs to be specified. * vertices to be added needs to be specified.
* \param num_vertices The number of vertices to be added. * @param num_vertices The number of vertices to be added.
*/ */
void AddVertices(uint64_t num_vertices) override; void AddVertices(uint64_t num_vertices) override;
/*! /*!
* \brief Add one edge to the graph. * @brief Add one edge to the graph.
* \param src The source vertex. * @param src The source vertex.
* \param dst The destination vertex. * @param dst The destination vertex.
*/ */
void AddEdge(dgl_id_t src, dgl_id_t dst) override; void AddEdge(dgl_id_t src, dgl_id_t dst) override;
/*! /*!
* \brief Add edges to the graph. * @brief Add edges to the graph.
* \param src_ids The source vertex id array. * @param src_ids The source vertex id array.
* \param dst_ids The destination vertex id array. * @param dst_ids The destination vertex id array.
*/ */
void AddEdges(IdArray src_ids, IdArray dst_ids) override; void AddEdges(IdArray src_ids, IdArray dst_ids) override;
/*! /*!
* \brief Clear the graph. Remove all vertices/edges. * @brief Clear the graph. Remove all vertices/edges.
*/ */
void Clear() override { void Clear() override {
adjlist_.clear(); adjlist_.clear();
...@@ -93,13 +93,13 @@ class Graph : public GraphInterface { ...@@ -93,13 +93,13 @@ class Graph : public GraphInterface {
uint8_t NumBits() const override { return 64; } uint8_t NumBits() const override { return 64; }
/*! /*!
* \note not const since we have caches * @note not const since we have caches
* \return whether the graph is a multigraph * @return whether the graph is a multigraph
*/ */
bool IsMultigraph() const override; bool IsMultigraph() const override;
/*! /*!
* \return whether the graph is read-only * @return whether the graph is read-only
*/ */
bool IsReadonly() const override { return false; } bool IsReadonly() const override { return false; }
...@@ -121,48 +121,48 @@ class Graph : public GraphInterface { ...@@ -121,48 +121,48 @@ class Graph : public GraphInterface {
BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const override; BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const override;
/*! /*!
* \brief Find the predecessors of a vertex. * @brief Find the predecessors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the predecessor id array. * @return the predecessor id array.
*/ */
IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const override; IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const override;
/*! /*!
* \brief Find the successors of a vertex. * @brief Find the successors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the successor id array. * @return the successor id array.
*/ */
IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const override; IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const override;
/*! /*!
* \brief Get all edge ids between the two given endpoints * @brief Get all edge ids between the two given endpoints
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* \param src The source vertex. * @param src The source vertex.
* \param dst The destination vertex. * @param dst The destination vertex.
* \return the edge id array. * @return the edge id array.
*/ */
IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const override; IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const override;
/*! /*!
* \brief Get all edge ids between the given endpoint pairs. * @brief Get all edge ids between the given endpoint pairs.
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* If duplicate pairs exist, the returned edge IDs will also duplicate. * If duplicate pairs exist, the returned edge IDs will also duplicate.
* The order of returned edge IDs will follow the order of src-dst pairs * The order of returned edge IDs will follow the order of src-dst pairs
* first, and ties are broken by the order of edge ID. * first, and ties are broken by the order of edge ID.
* \return EdgeArray containing all edges between all pairs. * @return EdgeArray containing all edges between all pairs.
*/ */
EdgeArray EdgeIds(IdArray src, IdArray dst) const override; EdgeArray EdgeIds(IdArray src, IdArray dst) const override;
/*! /*!
* \brief Find the edge ID and return the pair of endpoints * @brief Find the edge ID and return the pair of endpoints
* \param eid The edge ID * @param eid The edge ID
* \return a pair whose first element is the source and the second the * @return a pair whose first element is the source and the second the
* destination. * destination.
*/ */
std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const override { std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const override {
...@@ -170,57 +170,57 @@ class Graph : public GraphInterface { ...@@ -170,57 +170,57 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Find the edge IDs and return their source and target node IDs. * @brief Find the edge IDs and return their source and target node IDs.
* \param eids The edge ID array. * @param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is * @return EdgeArray containing all edges with id in eid. The order is
* preserved. * preserved.
*/ */
EdgeArray FindEdges(IdArray eids) const override; EdgeArray FindEdges(IdArray eids) const override;
/*! /*!
* \brief Get the in edges of the vertex. * @brief Get the in edges of the vertex.
* \note The returned dst id array is filled with vid. * @note The returned dst id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the edges * @return the edges
*/ */
EdgeArray InEdges(dgl_id_t vid) const override; EdgeArray InEdges(dgl_id_t vid) const override;
/*! /*!
* \brief Get the in edges of the vertices. * @brief Get the in edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray InEdges(IdArray vids) const override; EdgeArray InEdges(IdArray vids) const override;
/*! /*!
* \brief Get the out edges of the vertex. * @brief Get the out edges of the vertex.
* \note The returned src id array is filled with vid. * @note The returned src id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray OutEdges(dgl_id_t vid) const override; EdgeArray OutEdges(dgl_id_t vid) const override;
/*! /*!
* \brief Get the out edges of the vertices. * @brief Get the out edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray OutEdges(IdArray vids) const override; EdgeArray OutEdges(IdArray vids) const override;
/*! /*!
* \brief Get all the edges in the graph. * @brief Get all the edges in the graph.
* \note If sorted is true, the returned edges list is sorted by their src and * @note If sorted is true, the returned edges list is sorted by their src and
* dst ids. Otherwise, they are in their edge id order. * dst ids. Otherwise, they are in their edge id order.
* \param sorted Whether the returned edge list is sorted by their src and dst * @param sorted Whether the returned edge list is sorted by their src and dst
* ids. * ids.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray Edges(const std::string& order = "") const override; EdgeArray Edges(const std::string& order = "") const override;
/*! /*!
* \brief Get the in degree of the given vertex. * @brief Get the in degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the in degree * @return the in degree
*/ */
uint64_t InDegree(dgl_id_t vid) const override { uint64_t InDegree(dgl_id_t vid) const override {
CHECK(HasVertex(vid)) << "invalid vertex: " << vid; CHECK(HasVertex(vid)) << "invalid vertex: " << vid;
...@@ -228,16 +228,16 @@ class Graph : public GraphInterface { ...@@ -228,16 +228,16 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Get the in degrees of the given vertices. * @brief Get the in degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the in degree array * @return the in degree array
*/ */
DegreeArray InDegrees(IdArray vids) const override; DegreeArray InDegrees(IdArray vids) const override;
/*! /*!
* \brief Get the out degree of the given vertex. * @brief Get the out degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the out degree * @return the out degree
*/ */
uint64_t OutDegree(dgl_id_t vid) const override { uint64_t OutDegree(dgl_id_t vid) const override {
CHECK(HasVertex(vid)) << "invalid vertex: " << vid; CHECK(HasVertex(vid)) << "invalid vertex: " << vid;
...@@ -245,14 +245,14 @@ class Graph : public GraphInterface { ...@@ -245,14 +245,14 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Get the out degrees of the given vertices. * @brief Get the out degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the out degree array * @return the out degree array
*/ */
DegreeArray OutDegrees(IdArray vids) const override; DegreeArray OutDegrees(IdArray vids) const override;
/*! /*!
* \brief Construct the induced subgraph of the given vertices. * @brief Construct the induced subgraph of the given vertices.
* *
* The induced subgraph is a subgraph formed by specifying a set of vertices * The induced subgraph is a subgraph formed by specifying a set of vertices
* V' and then selecting all of the edges from the original graph that connect * V' and then selecting all of the edges from the original graph that connect
...@@ -265,13 +265,13 @@ class Graph : public GraphInterface { ...@@ -265,13 +265,13 @@ class Graph : public GraphInterface {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param vids The vertices in the subgraph. * @param vids The vertices in the subgraph.
* \return the induced subgraph * @return the induced subgraph
*/ */
Subgraph VertexSubgraph(IdArray vids) const override; Subgraph VertexSubgraph(IdArray vids) const override;
/*! /*!
* \brief Construct the induced edge subgraph of the given edges. * @brief Construct the induced edge subgraph of the given edges.
* *
* The induced edges subgraph is a subgraph formed by specifying a set of * The induced edges subgraph is a subgraph formed by specifying a set of
* edges E' and then selecting all of the nodes from the original graph that * edges E' and then selecting all of the nodes from the original graph that
...@@ -284,16 +284,16 @@ class Graph : public GraphInterface { ...@@ -284,16 +284,16 @@ class Graph : public GraphInterface {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param eids The edges in the subgraph. * @param eids The edges in the subgraph.
* \return the induced edge subgraph * @return the induced edge subgraph
*/ */
Subgraph EdgeSubgraph( Subgraph EdgeSubgraph(
IdArray eids, bool preserve_nodes = false) const override; IdArray eids, bool preserve_nodes = false) const override;
/*! /*!
* \brief Return the successor vector * @brief Return the successor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the successor vector * @return the successor vector
*/ */
DGLIdIters SuccVec(dgl_id_t vid) const override { DGLIdIters SuccVec(dgl_id_t vid) const override {
auto data = adjlist_[vid].succ.data(); auto data = adjlist_[vid].succ.data();
...@@ -302,9 +302,9 @@ class Graph : public GraphInterface { ...@@ -302,9 +302,9 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Return the out edge id vector * @brief Return the out edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the out edge id vector * @return the out edge id vector
*/ */
DGLIdIters OutEdgeVec(dgl_id_t vid) const override { DGLIdIters OutEdgeVec(dgl_id_t vid) const override {
auto data = adjlist_[vid].edge_id.data(); auto data = adjlist_[vid].edge_id.data();
...@@ -313,9 +313,9 @@ class Graph : public GraphInterface { ...@@ -313,9 +313,9 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Return the predecessor vector * @brief Return the predecessor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the predecessor vector * @return the predecessor vector
*/ */
DGLIdIters PredVec(dgl_id_t vid) const override { DGLIdIters PredVec(dgl_id_t vid) const override {
auto data = reverse_adjlist_[vid].succ.data(); auto data = reverse_adjlist_[vid].succ.data();
...@@ -324,9 +324,9 @@ class Graph : public GraphInterface { ...@@ -324,9 +324,9 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Return the in edge id vector * @brief Return the in edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the in edge id vector * @return the in edge id vector
*/ */
DGLIdIters InEdgeVec(dgl_id_t vid) const override { DGLIdIters InEdgeVec(dgl_id_t vid) const override {
auto data = reverse_adjlist_[vid].edge_id.data(); auto data = reverse_adjlist_[vid].edge_id.data();
...@@ -335,21 +335,21 @@ class Graph : public GraphInterface { ...@@ -335,21 +335,21 @@ class Graph : public GraphInterface {
} }
/*! /*!
* \brief Get the adjacency matrix of the graph. * @brief Get the adjacency matrix of the graph.
* *
* By default, a row of returned adjacency matrix represents the destination * By default, a row of returned adjacency matrix represents the destination
* of an edge and the column represents the source. * of an edge and the column represents the source.
* \param transpose A flag to transpose the returned adjacency matrix. * @param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix. * @param fmt the format of the returned adjacency matrix.
* \return a vector of three IdArray. * @return a vector of three IdArray.
*/ */
std::vector<IdArray> GetAdj( std::vector<IdArray> GetAdj(
bool transpose, const std::string& fmt) const override; bool transpose, const std::string& fmt) const override;
/*! \brief Create an empty graph */ /*! @brief Create an empty graph */
static MutableGraphPtr Create() { return std::make_shared<Graph>(); } static MutableGraphPtr Create() { return std::make_shared<Graph>(); }
/*! \brief Create from coo */ /*! @brief Create from coo */
static MutableGraphPtr CreateFromCOO( static MutableGraphPtr CreateFromCOO(
int64_t num_nodes, IdArray src_ids, IdArray dst_ids) { int64_t num_nodes, IdArray src_ids, IdArray dst_ids) {
return std::make_shared<Graph>(src_ids, dst_ids, num_nodes); return std::make_shared<Graph>(src_ids, dst_ids, num_nodes);
...@@ -357,29 +357,29 @@ class Graph : public GraphInterface { ...@@ -357,29 +357,29 @@ class Graph : public GraphInterface {
protected: protected:
friend class GraphOp; friend class GraphOp;
/*! \brief Internal edge list type */ /*! @brief Internal edge list type */
struct EdgeList { struct EdgeList {
/*! \brief successor vertex list */ /*! @brief successor vertex list */
std::vector<dgl_id_t> succ; std::vector<dgl_id_t> succ;
/*! \brief out edge list */ /*! @brief out edge list */
std::vector<dgl_id_t> edge_id; std::vector<dgl_id_t> edge_id;
}; };
typedef std::vector<EdgeList> AdjacencyList; typedef std::vector<EdgeList> AdjacencyList;
/*! \brief adjacency list using vector storage */ /*! @brief adjacency list using vector storage */
AdjacencyList adjlist_; AdjacencyList adjlist_;
/*! \brief reverse adjacency list using vector storage */ /*! @brief reverse adjacency list using vector storage */
AdjacencyList reverse_adjlist_; AdjacencyList reverse_adjlist_;
/*! \brief all edges' src endpoints in their edge id order */ /*! @brief all edges' src endpoints in their edge id order */
std::vector<dgl_id_t> all_edges_src_; std::vector<dgl_id_t> all_edges_src_;
/*! \brief all edges' dst endpoints in their edge id order */ /*! @brief all edges' dst endpoints in their edge id order */
std::vector<dgl_id_t> all_edges_dst_; std::vector<dgl_id_t> all_edges_dst_;
/*! \brief read only flag */ /*! @brief read only flag */
bool read_only_ = false; bool read_only_ = false;
/*! \brief number of edges */ /*! @brief number of edges */
uint64_t num_edges_ = 0; uint64_t num_edges_ = 0;
}; };
......
/*! /*!
* Copyright (c) 2018 by Contributors * Copyright (c) 2018 by Contributors
* \file dgl/graph_interface.h * @file dgl/graph_interface.h
* \brief DGL graph index class. * @brief DGL graph index class.
*/ */
#ifndef DGL_GRAPH_INTERFACE_H_ #ifndef DGL_GRAPH_INTERFACE_H_
#define DGL_GRAPH_INTERFACE_H_ #define DGL_GRAPH_INTERFACE_H_
...@@ -20,7 +20,7 @@ namespace dgl { ...@@ -20,7 +20,7 @@ namespace dgl {
const dgl_id_t DGL_INVALID_ID = static_cast<dgl_id_t>(-1); const dgl_id_t DGL_INVALID_ID = static_cast<dgl_id_t>(-1);
/*! /*!
* \brief This class references data in std::vector. * @brief This class references data in std::vector.
* *
* This isn't a STL-style iterator. It provides a STL data container interface. * This isn't a STL-style iterator. It provides a STL data container interface.
* but it doesn't own data itself. instead, it only references data in * but it doesn't own data itself. instead, it only references data in
...@@ -45,7 +45,7 @@ class DGLIdIters { ...@@ -45,7 +45,7 @@ class DGLIdIters {
}; };
/*! /*!
* \brief int32 version for DGLIdIters * @brief int32 version for DGLIdIters
* *
*/ */
class DGLIdIters32 { class DGLIdIters32 {
...@@ -66,9 +66,9 @@ class DGLIdIters32 { ...@@ -66,9 +66,9 @@ class DGLIdIters32 {
const int32_t *begin_{nullptr}, *end_{nullptr}; const int32_t *begin_{nullptr}, *end_{nullptr};
}; };
/* \brief structure used to represent a list of edges */ /* @brief structure used to represent a list of edges */
typedef struct { typedef struct {
/* \brief the two endpoints and the id of the edge */ /* @brief the two endpoints and the id of the edge */
IdArray src, dst, id; IdArray src, dst, id;
} EdgeArray; } EdgeArray;
...@@ -79,7 +79,7 @@ class GraphInterface; ...@@ -79,7 +79,7 @@ class GraphInterface;
typedef std::shared_ptr<GraphInterface> GraphPtr; typedef std::shared_ptr<GraphInterface> GraphPtr;
/*! /*!
* \brief dgl graph index interface. * @brief dgl graph index interface.
* *
* DGL's graph is directed. Vertices are integers enumerated from zero. * DGL's graph is directed. Vertices are integers enumerated from zero.
* *
...@@ -94,50 +94,50 @@ class GraphInterface : public runtime::Object { ...@@ -94,50 +94,50 @@ class GraphInterface : public runtime::Object {
virtual ~GraphInterface() = default; virtual ~GraphInterface() = default;
/*! /*!
* \brief Add vertices to the graph. * @brief Add vertices to the graph.
* \note Since vertices are integers enumerated from zero, only the number of * @note Since vertices are integers enumerated from zero, only the number of
* vertices to be added needs to be specified. * vertices to be added needs to be specified.
* \param num_vertices The number of vertices to be added. * @param num_vertices The number of vertices to be added.
*/ */
virtual void AddVertices(uint64_t num_vertices) = 0; virtual void AddVertices(uint64_t num_vertices) = 0;
/*! /*!
* \brief Add one edge to the graph. * @brief Add one edge to the graph.
* \param src The source vertex. * @param src The source vertex.
* \param dst The destination vertex. * @param dst The destination vertex.
*/ */
virtual void AddEdge(dgl_id_t src, dgl_id_t dst) = 0; virtual void AddEdge(dgl_id_t src, dgl_id_t dst) = 0;
/*! /*!
* \brief Add edges to the graph. * @brief Add edges to the graph.
* \param src_ids The source vertex id array. * @param src_ids The source vertex id array.
* \param dst_ids The destination vertex id array. * @param dst_ids The destination vertex id array.
*/ */
virtual void AddEdges(IdArray src_ids, IdArray dst_ids) = 0; virtual void AddEdges(IdArray src_ids, IdArray dst_ids) = 0;
/*! /*!
* \brief Clear the graph. Remove all vertices/edges. * @brief Clear the graph. Remove all vertices/edges.
*/ */
virtual void Clear() = 0; virtual void Clear() = 0;
/*! /*!
* \brief Get the device context of this graph. * @brief Get the device context of this graph.
*/ */
virtual DGLContext Context() const = 0; virtual DGLContext Context() const = 0;
/*! /*!
* \brief Get the number of integer bits used to store node/edge ids * @brief Get the number of integer bits used to store node/edge ids
* (32 or 64). * (32 or 64).
*/ */
virtual uint8_t NumBits() const = 0; virtual uint8_t NumBits() const = 0;
/*! /*!
* \return whether the graph is a multigraph * @return whether the graph is a multigraph
*/ */
virtual bool IsMultigraph() const = 0; virtual bool IsMultigraph() const = 0;
/*! /*!
* \return whether the graph is unibipartite * @return whether the graph is unibipartite
*/ */
virtual bool IsUniBipartite() const { virtual bool IsUniBipartite() const {
EdgeArray edges = Edges(); EdgeArray edges = Edges();
...@@ -168,7 +168,7 @@ class GraphInterface : public runtime::Object { ...@@ -168,7 +168,7 @@ class GraphInterface : public runtime::Object {
} }
/*! /*!
* \return whether the graph is read-only * @return whether the graph is read-only
*/ */
virtual bool IsReadonly() const = 0; virtual bool IsReadonly() const = 0;
...@@ -193,130 +193,130 @@ class GraphInterface : public runtime::Object { ...@@ -193,130 +193,130 @@ class GraphInterface : public runtime::Object {
virtual BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const = 0; virtual BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const = 0;
/*! /*!
* \brief Find the predecessors of a vertex. * @brief Find the predecessors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the predecessor id array. * @return the predecessor id array.
*/ */
virtual IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const = 0; virtual IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const = 0;
/*! /*!
* \brief Find the successors of a vertex. * @brief Find the successors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the successor id array. * @return the successor id array.
*/ */
virtual IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const = 0; virtual IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const = 0;
/*! /*!
* \brief Get all edge ids between the two given endpoints * @brief Get all edge ids between the two given endpoints
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* \param src The source vertex. * @param src The source vertex.
* \param dst The destination vertex. * @param dst The destination vertex.
* \return the edge id array. * @return the edge id array.
*/ */
virtual IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const = 0; virtual IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const = 0;
/*! /*!
* \brief Get all edge ids between the given endpoint pairs. * @brief Get all edge ids between the given endpoint pairs.
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* If duplicate pairs exist, the returned edge IDs will also duplicate. * If duplicate pairs exist, the returned edge IDs will also duplicate.
* The order of returned edge IDs will follow the order of src-dst pairs * The order of returned edge IDs will follow the order of src-dst pairs
* first, and ties are broken by the order of edge ID. * first, and ties are broken by the order of edge ID.
* \return EdgeArray containing all edges between all pairs. * @return EdgeArray containing all edges between all pairs.
*/ */
virtual EdgeArray EdgeIds(IdArray src, IdArray dst) const = 0; virtual EdgeArray EdgeIds(IdArray src, IdArray dst) const = 0;
/*! /*!
* \brief Find the edge ID and return the pair of endpoints * @brief Find the edge ID and return the pair of endpoints
* \param eid The edge ID * @param eid The edge ID
* \return a pair whose first element is the source and the second the * @return a pair whose first element is the source and the second the
* destination. * destination.
*/ */
virtual std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const = 0; virtual std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const = 0;
/*! /*!
* \brief Find the edge IDs and return their source and target node IDs. * @brief Find the edge IDs and return their source and target node IDs.
* \param eids The edge ID array. * @param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is * @return EdgeArray containing all edges with id in eid. The order is
* preserved. * preserved.
*/ */
virtual EdgeArray FindEdges(IdArray eids) const = 0; virtual EdgeArray FindEdges(IdArray eids) const = 0;
/*! /*!
* \brief Get the in edges of the vertex. * @brief Get the in edges of the vertex.
* \note The returned dst id array is filled with vid. * @note The returned dst id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the edges * @return the edges
*/ */
virtual EdgeArray InEdges(dgl_id_t vid) const = 0; virtual EdgeArray InEdges(dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the in edges of the vertices. * @brief Get the in edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray InEdges(IdArray vids) const = 0; virtual EdgeArray InEdges(IdArray vids) const = 0;
/*! /*!
* \brief Get the out edges of the vertex. * @brief Get the out edges of the vertex.
* \note The returned src id array is filled with vid. * @note The returned src id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray OutEdges(dgl_id_t vid) const = 0; virtual EdgeArray OutEdges(dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the out edges of the vertices. * @brief Get the out edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray OutEdges(IdArray vids) const = 0; virtual EdgeArray OutEdges(IdArray vids) const = 0;
/*! /*!
* \brief Get all the edges in the graph. * @brief Get all the edges in the graph.
* \note If order is "srcdst", the returned edges list is sorted by their src * @note If order is "srcdst", the returned edges list is sorted by their src
* and dst ids. If order is "eid", they are in their edge id order. * and dst ids. If order is "eid", they are in their edge id order.
* Otherwise, in the arbitrary order. * Otherwise, in the arbitrary order.
* \param order The order of the returned edge list. * @param order The order of the returned edge list.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
virtual EdgeArray Edges(const std::string &order = "") const = 0; virtual EdgeArray Edges(const std::string &order = "") const = 0;
/*! /*!
* \brief Get the in degree of the given vertex. * @brief Get the in degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the in degree * @return the in degree
*/ */
virtual uint64_t InDegree(dgl_id_t vid) const = 0; virtual uint64_t InDegree(dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the in degrees of the given vertices. * @brief Get the in degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the in degree array * @return the in degree array
*/ */
virtual DegreeArray InDegrees(IdArray vids) const = 0; virtual DegreeArray InDegrees(IdArray vids) const = 0;
/*! /*!
* \brief Get the out degree of the given vertex. * @brief Get the out degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the out degree * @return the out degree
*/ */
virtual uint64_t OutDegree(dgl_id_t vid) const = 0; virtual uint64_t OutDegree(dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the out degrees of the given vertices. * @brief Get the out degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the out degree array * @return the out degree array
*/ */
virtual DegreeArray OutDegrees(IdArray vids) const = 0; virtual DegreeArray OutDegrees(IdArray vids) const = 0;
/*! /*!
* \brief Construct the induced subgraph of the given vertices. * @brief Construct the induced subgraph of the given vertices.
* *
* The induced subgraph is a subgraph formed by specifying a set of vertices * The induced subgraph is a subgraph formed by specifying a set of vertices
* V' and then selecting all of the edges from the original graph that connect * V' and then selecting all of the edges from the original graph that connect
...@@ -329,13 +329,13 @@ class GraphInterface : public runtime::Object { ...@@ -329,13 +329,13 @@ class GraphInterface : public runtime::Object {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param vids The vertices in the subgraph. * @param vids The vertices in the subgraph.
* \return the induced subgraph * @return the induced subgraph
*/ */
virtual Subgraph VertexSubgraph(IdArray vids) const = 0; virtual Subgraph VertexSubgraph(IdArray vids) const = 0;
/*! /*!
* \brief Construct the induced edge subgraph of the given edges. * @brief Construct the induced edge subgraph of the given edges.
* *
* The induced edges subgraph is a subgraph formed by specifying a set of * The induced edges subgraph is a subgraph formed by specifying a set of
* edges E' and then selecting all of the nodes from the original graph that * edges E' and then selecting all of the nodes from the original graph that
...@@ -348,44 +348,44 @@ class GraphInterface : public runtime::Object { ...@@ -348,44 +348,44 @@ class GraphInterface : public runtime::Object {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param eids The edges in the subgraph. * @param eids The edges in the subgraph.
* \param preserve_nodes If true, the vertices will not be relabeled, so some * @param preserve_nodes If true, the vertices will not be relabeled, so some
* vertices may have no incident edges. * vertices may have no incident edges.
* \return the induced edge subgraph * @return the induced edge subgraph
*/ */
virtual Subgraph EdgeSubgraph( virtual Subgraph EdgeSubgraph(
IdArray eids, bool preserve_nodes = false) const = 0; IdArray eids, bool preserve_nodes = false) const = 0;
/*! /*!
* \brief Return the successor vector * @brief Return the successor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the successor vector iterator pair. * @return the successor vector iterator pair.
*/ */
virtual DGLIdIters SuccVec(dgl_id_t vid) const = 0; virtual DGLIdIters SuccVec(dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the out edge id vector * @brief Return the out edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the out edge id vector iterator pair. * @return the out edge id vector iterator pair.
*/ */
virtual DGLIdIters OutEdgeVec(dgl_id_t vid) const = 0; virtual DGLIdIters OutEdgeVec(dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the predecessor vector * @brief Return the predecessor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the predecessor vector iterator pair. * @return the predecessor vector iterator pair.
*/ */
virtual DGLIdIters PredVec(dgl_id_t vid) const = 0; virtual DGLIdIters PredVec(dgl_id_t vid) const = 0;
/*! /*!
* \brief Return the in edge id vector * @brief Return the in edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the in edge id vector iterator pair. * @return the in edge id vector iterator pair.
*/ */
virtual DGLIdIters InEdgeVec(dgl_id_t vid) const = 0; virtual DGLIdIters InEdgeVec(dgl_id_t vid) const = 0;
/*! /*!
* \brief Get the adjacency matrix of the graph. * @brief Get the adjacency matrix of the graph.
* *
* By default, a row of returned adjacency matrix represents the destination * By default, a row of returned adjacency matrix represents the destination
* of an edge and the column represents the source. * of an edge and the column represents the source.
...@@ -396,15 +396,15 @@ class GraphInterface : public runtime::Object { ...@@ -396,15 +396,15 @@ class GraphInterface : public runtime::Object {
* If the fmt is 'coo', the function should return one array of shape (2, * If the fmt is 'coo', the function should return one array of shape (2,
* nnz), representing a horitonzal stack of row and col indices. * nnz), representing a horitonzal stack of row and col indices.
* *
* \param transpose A flag to transpose the returned adjacency matrix. * @param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix. * @param fmt the format of the returned adjacency matrix.
* \return a vector of IdArrays. * @return a vector of IdArrays.
*/ */
virtual std::vector<IdArray> GetAdj( virtual std::vector<IdArray> GetAdj(
bool transpose, const std::string &fmt) const = 0; bool transpose, const std::string &fmt) const = 0;
/*! /*!
* \brief Sort the columns in CSR. * @brief Sort the columns in CSR.
* *
* This sorts the columns in each row based on the column Ids. * This sorts the columns in each row based on the column Ids.
* The edge ids should be sorted accordingly. * The edge ids should be sorted accordingly.
...@@ -418,19 +418,19 @@ class GraphInterface : public runtime::Object { ...@@ -418,19 +418,19 @@ class GraphInterface : public runtime::Object {
// Define GraphRef // Define GraphRef
DGL_DEFINE_OBJECT_REF(GraphRef, GraphInterface); DGL_DEFINE_OBJECT_REF(GraphRef, GraphInterface);
/*! \brief Subgraph data structure */ /*! @brief Subgraph data structure */
struct Subgraph : public runtime::Object { struct Subgraph : public runtime::Object {
/*! \brief The graph. */ /*! @brief The graph. */
GraphPtr graph; GraphPtr graph;
/*! /*!
* \brief The induced vertex ids. * @brief The induced vertex ids.
* \note This is also a map from the new vertex id to the vertex id in the * @note This is also a map from the new vertex id to the vertex id in the
* parent graph. * parent graph.
*/ */
IdArray induced_vertices; IdArray induced_vertices;
/*! /*!
* \brief The induced edge ids. * @brief The induced edge ids.
* \note This is also a map from the new edge id to the edge id in the parent * @note This is also a map from the new edge id to the edge id in the parent
* graph. * graph.
*/ */
IdArray induced_edges; IdArray induced_edges;
...@@ -439,21 +439,21 @@ struct Subgraph : public runtime::Object { ...@@ -439,21 +439,21 @@ struct Subgraph : public runtime::Object {
DGL_DECLARE_OBJECT_TYPE_INFO(Subgraph, runtime::Object); DGL_DECLARE_OBJECT_TYPE_INFO(Subgraph, runtime::Object);
}; };
/*! \brief Subgraph data structure for negative subgraph */ /*! @brief Subgraph data structure for negative subgraph */
struct NegSubgraph : public Subgraph { struct NegSubgraph : public Subgraph {
/*! \brief The existence of the negative edges in the parent graph. */ /*! @brief The existence of the negative edges in the parent graph. */
IdArray exist; IdArray exist;
/*! \brief The Ids of head nodes */ /*! @brief The Ids of head nodes */
IdArray head_nid; IdArray head_nid;
/*! \brief The Ids of tail nodes */ /*! @brief The Ids of tail nodes */
IdArray tail_nid; IdArray tail_nid;
}; };
/*! \brief Subgraph data structure for halo subgraph */ /*! @brief Subgraph data structure for halo subgraph */
struct HaloSubgraph : public Subgraph { struct HaloSubgraph : public Subgraph {
/*! \brief Indicate if a node belongs to the partition. */ /*! @brief Indicate if a node belongs to the partition. */
IdArray inner_nodes; IdArray inner_nodes;
}; };
......
/*! /*!
* Copyright (c) 2018 by Contributors * Copyright (c) 2018 by Contributors
* \file dgl/graph_op.h * @file dgl/graph_op.h
* \brief Operations on graph index. * @brief Operations on graph index.
*/ */
#ifndef DGL_GRAPH_OP_H_ #ifndef DGL_GRAPH_OP_H_
#define DGL_GRAPH_OP_H_ #define DGL_GRAPH_OP_H_
...@@ -16,30 +16,30 @@ namespace dgl { ...@@ -16,30 +16,30 @@ namespace dgl {
class GraphOp { class GraphOp {
public: public:
/*! /*!
* \brief Return a new graph with all the edges reversed. * @brief Return a new graph with all the edges reversed.
* *
* The returned graph preserves the vertex and edge index in the original * The returned graph preserves the vertex and edge index in the original
* graph. * graph.
* *
* \return the reversed graph * @return the reversed graph
*/ */
static GraphPtr Reverse(GraphPtr graph); static GraphPtr Reverse(GraphPtr graph);
/*! /*!
* \brief Return the line graph. * @brief Return the line graph.
* *
* If i~j and j~i are two edges in original graph G, then * If i~j and j~i are two edges in original graph G, then
* (i,j)~(j,i) and (j,i)~(i,j) are the "backtracking" edges on * (i,j)~(j,i) and (j,i)~(i,j) are the "backtracking" edges on
* the line graph. * the line graph.
* *
* \param graph The input graph. * @param graph The input graph.
* \param backtracking Whether the backtracking edges are included or not * @param backtracking Whether the backtracking edges are included or not
* \return the line graph * @return the line graph
*/ */
static GraphPtr LineGraph(GraphPtr graph, bool backtracking); static GraphPtr LineGraph(GraphPtr graph, bool backtracking);
/*! /*!
* \brief Return a disjoint union of the input graphs. * @brief Return a disjoint union of the input graphs.
* *
* The new graph will include all the nodes/edges in the given graphs. * The new graph will include all the nodes/edges in the given graphs.
* Nodes/Edges will be relabled by adding the cumsum of the previous graph * Nodes/Edges will be relabled by adding the cumsum of the previous graph
...@@ -50,13 +50,13 @@ class GraphOp { ...@@ -50,13 +50,13 @@ class GraphOp {
* The input list must be either ALL mutable graphs or ALL immutable graphs. * The input list must be either ALL mutable graphs or ALL immutable graphs.
* The returned graph type is also determined by the input graph type. * The returned graph type is also determined by the input graph type.
* *
* \param graphs A list of input graphs to be unioned. * @param graphs A list of input graphs to be unioned.
* \return the disjoint union of the graphs * @return the disjoint union of the graphs
*/ */
static GraphPtr DisjointUnion(std::vector<GraphPtr> graphs); static GraphPtr DisjointUnion(std::vector<GraphPtr> graphs);
/*! /*!
* \brief Partition the graph into several subgraphs. * @brief Partition the graph into several subgraphs.
* *
* This is a reverse operation of DisjointUnion. The graph will be partitioned * This is a reverse operation of DisjointUnion. The graph will be partitioned
* into num graphs. This requires the given number of partitions to evenly * into num graphs. This requires the given number of partitions to evenly
...@@ -65,15 +65,15 @@ class GraphOp { ...@@ -65,15 +65,15 @@ class GraphOp {
* If the input graph is mutable, the result graphs are mutable. * If the input graph is mutable, the result graphs are mutable.
* If the input graph is immutable, the result graphs are immutable. * If the input graph is immutable, the result graphs are immutable.
* *
* \param graph The graph to be partitioned. * @param graph The graph to be partitioned.
* \param num The number of partitions. * @param num The number of partitions.
* \return a list of partitioned graphs * @return a list of partitioned graphs
*/ */
static std::vector<GraphPtr> DisjointPartitionByNum( static std::vector<GraphPtr> DisjointPartitionByNum(
GraphPtr graph, int64_t num); GraphPtr graph, int64_t num);
/*! /*!
* \brief Partition the graph into several subgraphs. * @brief Partition the graph into several subgraphs.
* *
* This is a reverse operation of DisjointUnion. The graph will be partitioned * This is a reverse operation of DisjointUnion. The graph will be partitioned
* based on the given sizes. This requires the sum of the given sizes is equal * based on the given sizes. This requires the sum of the given sizes is equal
...@@ -82,28 +82,28 @@ class GraphOp { ...@@ -82,28 +82,28 @@ class GraphOp {
* If the input graph is mutable, the result graphs are mutable. * If the input graph is mutable, the result graphs are mutable.
* If the input graph is immutable, the result graphs are immutable. * If the input graph is immutable, the result graphs are immutable.
* *
* \param graph The graph to be partitioned. * @param graph The graph to be partitioned.
* \param sizes The number of partitions. * @param sizes The number of partitions.
* \return a list of partitioned graphs * @return a list of partitioned graphs
*/ */
static std::vector<GraphPtr> DisjointPartitionBySizes( static std::vector<GraphPtr> DisjointPartitionBySizes(
GraphPtr graph, IdArray sizes); GraphPtr graph, IdArray sizes);
/*! /*!
* \brief Map vids in the parent graph to the vids in the subgraph. * @brief Map vids in the parent graph to the vids in the subgraph.
* *
* If the Id doesn't exist in the subgraph, -1 will be used. * If the Id doesn't exist in the subgraph, -1 will be used.
* *
* \param parent_vid_map An array that maps the vids in the parent graph to * @param parent_vid_map An array that maps the vids in the parent graph to
* the subgraph. The elements store the vertex Ids in the parent graph, and * the subgraph. The elements store the vertex Ids in the parent graph, and
* the indices indicate the vertex Ids in the subgraph. * the indices indicate the vertex Ids in the subgraph.
* \param query The vertex Ids in the parent graph. * @param query The vertex Ids in the parent graph.
* \return an Id array that contains the subgraph node Ids. * @return an Id array that contains the subgraph node Ids.
*/ */
static IdArray MapParentIdToSubgraphId(IdArray parent_vid_map, IdArray query); static IdArray MapParentIdToSubgraphId(IdArray parent_vid_map, IdArray query);
/*! /*!
* \brief Expand an Id array based on the offset array. * @brief Expand an Id array based on the offset array.
* *
* For example, * For example,
* ids: [0, 1, 2, 3, 4], * ids: [0, 1, 2, 3, 4],
...@@ -112,68 +112,68 @@ class GraphOp { ...@@ -112,68 +112,68 @@ class GraphOp {
* The offset array has one more element than the ids array. * The offset array has one more element than the ids array.
* (offset[i], offset[i+1]) shows the location of ids[i] in the result array. * (offset[i], offset[i+1]) shows the location of ids[i] in the result array.
* *
* \param ids An array that contains the node or edge Ids. * @param ids An array that contains the node or edge Ids.
* \param offset An array that contains the offset after expansion. * @param offset An array that contains the offset after expansion.
* \return a expanded Id array. * @return a expanded Id array.
*/ */
static IdArray ExpandIds(IdArray ids, IdArray offset); static IdArray ExpandIds(IdArray ids, IdArray offset);
/*! /*!
* \brief Convert the graph to a simple graph. * @brief Convert the graph to a simple graph.
* \param graph The input graph. * @param graph The input graph.
* \return a new immutable simple graph with no multi-edge. * @return a new immutable simple graph with no multi-edge.
*/ */
static GraphPtr ToSimpleGraph(GraphPtr graph); static GraphPtr ToSimpleGraph(GraphPtr graph);
/*! /*!
* \brief Convert the graph to a mutable bidirected graph. * @brief Convert the graph to a mutable bidirected graph.
* *
* If the original graph has m edges for i -> j and n edges for * If the original graph has m edges for i -> j and n edges for
* j -> i, the new graph will have max(m, n) edges for both * j -> i, the new graph will have max(m, n) edges for both
* i -> j and j -> i. * i -> j and j -> i.
* *
* \param graph The input graph. * @param graph The input graph.
* \return a new mutable bidirected graph. * @return a new mutable bidirected graph.
*/ */
static GraphPtr ToBidirectedMutableGraph(GraphPtr graph); static GraphPtr ToBidirectedMutableGraph(GraphPtr graph);
/*! /*!
* \brief Same as BidirectedMutableGraph except that the returned graph is * @brief Same as BidirectedMutableGraph except that the returned graph is
* immutable. * immutable.
* \param graph The input graph. * @param graph The input graph.
* \return a new immutable bidirected * @return a new immutable bidirected
* graph. * graph.
*/ */
static GraphPtr ToBidirectedImmutableGraph(GraphPtr graph); static GraphPtr ToBidirectedImmutableGraph(GraphPtr graph);
/*! /*!
* \brief Same as BidirectedMutableGraph except that the returned graph is * @brief Same as BidirectedMutableGraph except that the returned graph is
* immutable and call gk_csr_MakeSymmetric in GKlib. This is more efficient * immutable and call gk_csr_MakeSymmetric in GKlib. This is more efficient
* than ToBidirectedImmutableGraph. It return a null pointer if the conversion * than ToBidirectedImmutableGraph. It return a null pointer if the conversion
* fails. * fails.
* *
* \param graph The input graph. * @param graph The input graph.
* \return a new immutable bidirected graph. * @return a new immutable bidirected graph.
*/ */
static GraphPtr ToBidirectedSimpleImmutableGraph(ImmutableGraphPtr ig); static GraphPtr ToBidirectedSimpleImmutableGraph(ImmutableGraphPtr ig);
/*! /*!
* \brief Get a induced subgraph with HALO nodes. * @brief Get a induced subgraph with HALO nodes.
* The HALO nodes are the ones that can be reached from `nodes` within * The HALO nodes are the ones that can be reached from `nodes` within
* `num_hops`. * `num_hops`.
* \param graph The input graph. * @param graph The input graph.
* \param nodes The input nodes that form the core of the induced subgraph. * @param nodes The input nodes that form the core of the induced subgraph.
* \param num_hops The number of hops to reach. * @param num_hops The number of hops to reach.
* \return the induced subgraph with HALO nodes. * @return the induced subgraph with HALO nodes.
*/ */
static HaloSubgraph GetSubgraphWithHalo( static HaloSubgraph GetSubgraphWithHalo(
GraphPtr graph, IdArray nodes, int num_hops); GraphPtr graph, IdArray nodes, int num_hops);
/*! /*!
* \brief Reorder the nodes in the immutable graph. * @brief Reorder the nodes in the immutable graph.
* \param graph The input graph. * @param graph The input graph.
* \param new_order The node Ids in the new graph. The index in `new_order` is * @param new_order The node Ids in the new graph. The index in `new_order` is
* old node Ids. * old node Ids.
* \return the graph with reordered node Ids * @return the graph with reordered node Ids
*/ */
static GraphPtr ReorderImmutableGraph( static GraphPtr ReorderImmutableGraph(
ImmutableGraphPtr ig, IdArray new_order); ImmutableGraphPtr ig, IdArray new_order);
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/graph_traversal.h * @file dgl/graph_traversal.h
* \brief common graph traversal operations * @brief common graph traversal operations
*/ */
#ifndef DGL_GRAPH_TRAVERSAL_H_ #ifndef DGL_GRAPH_TRAVERSAL_H_
#define DGL_GRAPH_TRAVERSAL_H_ #define DGL_GRAPH_TRAVERSAL_H_
...@@ -13,7 +13,7 @@ namespace dgl { ...@@ -13,7 +13,7 @@ namespace dgl {
///////////////////////// Graph Traverse routines ////////////////////////// ///////////////////////// Graph Traverse routines //////////////////////////
/*! /*!
* \brief Class for representing frontiers. * @brief Class for representing frontiers.
* *
* Each frontier is a list of nodes/edges (specified by their ids). * Each frontier is a list of nodes/edges (specified by their ids).
* An optional tag can be specified on each node/edge (represented by an int * An optional tag can be specified on each node/edge (represented by an int
...@@ -24,7 +24,7 @@ struct Frontiers { ...@@ -24,7 +24,7 @@ struct Frontiers {
IdArray ids; IdArray ids;
/*! /*!
* \brief a vector store for node/edge tags. Dtype is int64. * @brief a vector store for node/edge tags. Dtype is int64.
* Empty if no tags are requested * Empty if no tags are requested
*/ */
IdArray tags; IdArray tags;
...@@ -36,43 +36,43 @@ struct Frontiers { ...@@ -36,43 +36,43 @@ struct Frontiers {
namespace aten { namespace aten {
/*! /*!
* \brief Traverse the graph in a breadth-first-search (BFS) order. * @brief Traverse the graph in a breadth-first-search (BFS) order.
* *
* \param csr The input csr matrix. * @param csr The input csr matrix.
* \param sources Source nodes. * @param sources Source nodes.
* \return A Frontiers object containing the search result * @return A Frontiers object containing the search result
*/ */
Frontiers BFSNodesFrontiers(const CSRMatrix& csr, IdArray source); Frontiers BFSNodesFrontiers(const CSRMatrix& csr, IdArray source);
/*! /*!
* \brief Traverse the graph in a breadth-first-search (BFS) order, returning * @brief Traverse the graph in a breadth-first-search (BFS) order, returning
* the edges of the BFS tree. * the edges of the BFS tree.
* *
* \param csr The input csr matrix. * @param csr The input csr matrix.
* \param sources Source nodes. * @param sources Source nodes.
* \return A Frontiers object containing the search result * @return A Frontiers object containing the search result
*/ */
Frontiers BFSEdgesFrontiers(const CSRMatrix& csr, IdArray source); Frontiers BFSEdgesFrontiers(const CSRMatrix& csr, IdArray source);
/*! /*!
* \brief Traverse the graph in topological order. * @brief Traverse the graph in topological order.
* *
* \param csr The input csr matrix. * @param csr The input csr matrix.
* \return A Frontiers object containing the search result * @return A Frontiers object containing the search result
*/ */
Frontiers TopologicalNodesFrontiers(const CSRMatrix& csr); Frontiers TopologicalNodesFrontiers(const CSRMatrix& csr);
/*! /*!
* \brief Traverse the graph in a depth-first-search (DFS) order. * @brief Traverse the graph in a depth-first-search (DFS) order.
* *
* \param csr The input csr matrix. * @param csr The input csr matrix.
* \param sources Source nodes. * @param sources Source nodes.
* \return A Frontiers object containing the search result * @return A Frontiers object containing the search result
*/ */
Frontiers DGLDFSEdges(const CSRMatrix& csr, IdArray source); Frontiers DGLDFSEdges(const CSRMatrix& csr, IdArray source);
/*! /*!
* \brief Traverse the graph in a depth-first-search (DFS) order and return the * @brief Traverse the graph in a depth-first-search (DFS) order and return the
* recorded edge tag if return_labels is specified. * recorded edge tag if return_labels is specified.
* *
* The traversal visit edges in its DFS order. Edges have three tags: * The traversal visit edges in its DFS order. Edges have three tags:
...@@ -84,12 +84,12 @@ Frontiers DGLDFSEdges(const CSRMatrix& csr, IdArray source); ...@@ -84,12 +84,12 @@ Frontiers DGLDFSEdges(const CSRMatrix& csr, IdArray source);
* A NONTREE edge is one in which both `u` and `v` have been visisted but the * A NONTREE edge is one in which both `u` and `v` have been visisted but the
* edge is NOT in the DFS tree. * edge is NOT in the DFS tree.
* *
* \param csr The input csr matrix. * @param csr The input csr matrix.
* \param sources Source nodes. * @param sources Source nodes.
* \param has_reverse_edge If true, REVERSE edges are included * @param has_reverse_edge If true, REVERSE edges are included
* \param has_nontree_edge If true, NONTREE edges are included * @param has_nontree_edge If true, NONTREE edges are included
* \param return_labels If true, return the recorded edge tags. * @param return_labels If true, return the recorded edge tags.
* \return A Frontiers object containing the search result * @return A Frontiers object containing the search result
*/ */
Frontiers DGLDFSLabeledEdges( Frontiers DGLDFSLabeledEdges(
const CSRMatrix& csr, IdArray source, const bool has_reverse_edge, const CSRMatrix& csr, IdArray source, const bool has_reverse_edge,
......
/*! /*!
* Copyright (c) 2018 by Contributors * Copyright (c) 2018 by Contributors
* \file dgl/immutable_graph.h * @file dgl/immutable_graph.h
* \brief DGL immutable graph index class. * @brief DGL immutable graph index class.
*/ */
#ifndef DGL_IMMUTABLE_GRAPH_H_ #ifndef DGL_IMMUTABLE_GRAPH_H_
#define DGL_IMMUTABLE_GRAPH_H_ #define DGL_IMMUTABLE_GRAPH_H_
...@@ -30,7 +30,7 @@ class ImmutableGraph; ...@@ -30,7 +30,7 @@ class ImmutableGraph;
typedef std::shared_ptr<ImmutableGraph> ImmutableGraphPtr; typedef std::shared_ptr<ImmutableGraph> ImmutableGraphPtr;
/*! /*!
* \brief Graph class stored using CSR structure. * @brief Graph class stored using CSR structure.
*/ */
class CSR : public GraphInterface { class CSR : public GraphInterface {
public: public:
...@@ -180,40 +180,40 @@ class CSR : public GraphInterface { ...@@ -180,40 +180,40 @@ class CSR : public GraphInterface {
return {adj_.indptr, adj_.indices, adj_.data}; return {adj_.indptr, adj_.indices, adj_.data};
} }
/*! \brief Indicate whether this uses shared memory. */ /*! @brief Indicate whether this uses shared memory. */
bool IsSharedMem() const { return !shared_mem_name_.empty(); } bool IsSharedMem() const { return !shared_mem_name_.empty(); }
/*! \brief Return the reverse of this CSR graph (i.e, a CSC graph) */ /*! @brief Return the reverse of this CSR graph (i.e, a CSC graph) */
CSRPtr Transpose() const; CSRPtr Transpose() const;
/*! \brief Convert this CSR to COO */ /*! @brief Convert this CSR to COO */
COOPtr ToCOO() const; COOPtr ToCOO() const;
/*! /*!
* \return the csr matrix that represents this graph. * @return the csr matrix that represents this graph.
* \note The csr matrix shares the storage with this graph. * @note The csr matrix shares the storage with this graph.
* The data field of the CSR matrix stores the edge ids. * The data field of the CSR matrix stores the edge ids.
*/ */
aten::CSRMatrix ToCSRMatrix() const { return adj_; } aten::CSRMatrix ToCSRMatrix() const { return adj_; }
/*! /*!
* \brief Copy the data to another context. * @brief Copy the data to another context.
* \param ctx The target context. * @param ctx The target context.
* \return The graph under another context. * @return The graph under another context.
*/ */
CSR CopyTo(const DGLContext &ctx) const; CSR CopyTo(const DGLContext &ctx) const;
/*! /*!
* \brief Copy data to shared memory. * @brief Copy data to shared memory.
* \param name The name of the shared memory. * @param name The name of the shared memory.
* \return The graph in the shared memory * @return The graph in the shared memory
*/ */
CSR CopyToSharedMem(const std::string &name) const; CSR CopyToSharedMem(const std::string &name) const;
/*! /*!
* \brief Convert the graph to use the given number of bits for storage. * @brief Convert the graph to use the given number of bits for storage.
* \param bits The new number of integer bits (32 or 64). * @param bits The new number of integer bits (32 or 64).
* \return The graph with new bit size storage. * @return The graph with new bit size storage.
*/ */
CSR AsNumBits(uint8_t bits) const; CSR AsNumBits(uint8_t bits) const;
...@@ -239,7 +239,7 @@ class CSR : public GraphInterface { ...@@ -239,7 +239,7 @@ class CSR : public GraphInterface {
private: private:
friend class Serializer; friend class Serializer;
/*! \brief private default constructor */ /*! @brief private default constructor */
CSR() { adj_.sorted = false; } CSR() { adj_.sorted = false; }
// The internal CSR adjacency matrix. // The internal CSR adjacency matrix.
// The data field stores edge ids. // The data field stores edge ids.
...@@ -424,43 +424,43 @@ class COO : public GraphInterface { ...@@ -424,43 +424,43 @@ class COO : public GraphInterface {
} }
} }
/*! \brief Return the transpose of this COO */ /*! @brief Return the transpose of this COO */
COOPtr Transpose() const { COOPtr Transpose() const {
return COOPtr(new COO(adj_.num_rows, adj_.col, adj_.row)); return COOPtr(new COO(adj_.num_rows, adj_.col, adj_.row));
} }
/*! \brief Convert this COO to CSR */ /*! @brief Convert this COO to CSR */
CSRPtr ToCSR() const; CSRPtr ToCSR() const;
/*! /*!
* \brief Get the coo matrix that represents this graph. * @brief Get the coo matrix that represents this graph.
* \note The coo matrix shares the storage with this graph. * @note The coo matrix shares the storage with this graph.
* The data field of the coo matrix is none. * The data field of the coo matrix is none.
*/ */
aten::COOMatrix ToCOOMatrix() const { return adj_; } aten::COOMatrix ToCOOMatrix() const { return adj_; }
/*! /*!
* \brief Copy the data to another context. * @brief Copy the data to another context.
* \param ctx The target context. * @param ctx The target context.
* \return The graph under another context. * @return The graph under another context.
*/ */
COO CopyTo(const DGLContext &ctx) const; COO CopyTo(const DGLContext &ctx) const;
/*! /*!
* \brief Copy data to shared memory. * @brief Copy data to shared memory.
* \param name The name of the shared memory. * @param name The name of the shared memory.
* \return The graph in the shared memory * @return The graph in the shared memory
*/ */
COO CopyToSharedMem(const std::string &name) const; COO CopyToSharedMem(const std::string &name) const;
/*! /*!
* \brief Convert the graph to use the given number of bits for storage. * @brief Convert the graph to use the given number of bits for storage.
* \param bits The new number of integer bits (32 or 64). * @param bits The new number of integer bits (32 or 64).
* \return The graph with new bit size storage. * @return The graph with new bit size storage.
*/ */
COO AsNumBits(uint8_t bits) const; COO AsNumBits(uint8_t bits) const;
/*! \brief Indicate whether this uses shared memory. */ /*! @brief Indicate whether this uses shared memory. */
bool IsSharedMem() const { return false; } bool IsSharedMem() const { return false; }
// member getters // member getters
...@@ -479,17 +479,17 @@ class COO : public GraphInterface { ...@@ -479,17 +479,17 @@ class COO : public GraphInterface {
}; };
/*! /*!
* \brief DGL immutable graph index class. * @brief DGL immutable graph index class.
* *
* DGL's graph is directed. Vertices are integers enumerated from zero. * DGL's graph is directed. Vertices are integers enumerated from zero.
*/ */
class ImmutableGraph : public GraphInterface { class ImmutableGraph : public GraphInterface {
public: public:
/*! \brief Construct an immutable graph from the COO format. */ /*! @brief Construct an immutable graph from the COO format. */
explicit ImmutableGraph(COOPtr coo) : coo_(coo) {} explicit ImmutableGraph(COOPtr coo) : coo_(coo) {}
/*! /*!
* \brief Construct an immutable graph from the CSR format. * @brief Construct an immutable graph from the CSR format.
* *
* For a single graph, we need two CSRs, one stores the in-edges of vertices * For a single graph, we need two CSRs, one stores the in-edges of vertices
* and the other stores the out-edges of vertices. These two CSRs stores the * and the other stores the out-edges of vertices. These two CSRs stores the
...@@ -506,14 +506,14 @@ class ImmutableGraph : public GraphInterface { ...@@ -506,14 +506,14 @@ class ImmutableGraph : public GraphInterface {
CHECK(in_csr_ || out_csr_) << "Both CSR are missing."; CHECK(in_csr_ || out_csr_) << "Both CSR are missing.";
} }
/*! \brief Construct an immutable graph from one CSR. */ /*! @brief Construct an immutable graph from one CSR. */
explicit ImmutableGraph(CSRPtr csr) : out_csr_(csr) {} explicit ImmutableGraph(CSRPtr csr) : out_csr_(csr) {}
/*! \brief default copy constructor */ /*! @brief default copy constructor */
ImmutableGraph(const ImmutableGraph &other) = default; ImmutableGraph(const ImmutableGraph &other) = default;
#ifndef _MSC_VER #ifndef _MSC_VER
/*! \brief default move constructor */ /*! @brief default move constructor */
ImmutableGraph(ImmutableGraph &&other) = default; ImmutableGraph(ImmutableGraph &&other) = default;
#else #else
ImmutableGraph(ImmutableGraph &&other) { ImmutableGraph(ImmutableGraph &&other) {
...@@ -526,10 +526,10 @@ class ImmutableGraph : public GraphInterface { ...@@ -526,10 +526,10 @@ class ImmutableGraph : public GraphInterface {
} }
#endif // _MSC_VER #endif // _MSC_VER
/*! \brief default assign constructor */ /*! @brief default assign constructor */
ImmutableGraph &operator=(const ImmutableGraph &other) = default; ImmutableGraph &operator=(const ImmutableGraph &other) = default;
/*! \brief default destructor */ /*! @brief default destructor */
~ImmutableGraph() = default; ~ImmutableGraph() = default;
void AddVertices(uint64_t num_vertices) override { void AddVertices(uint64_t num_vertices) override {
...@@ -553,18 +553,18 @@ class ImmutableGraph : public GraphInterface { ...@@ -553,18 +553,18 @@ class ImmutableGraph : public GraphInterface {
uint8_t NumBits() const override { return AnyGraph()->NumBits(); } uint8_t NumBits() const override { return AnyGraph()->NumBits(); }
/*! /*!
* \note not const since we have caches * @note not const since we have caches
* \return whether the graph is a multigraph * @return whether the graph is a multigraph
*/ */
bool IsMultigraph() const override { return AnyGraph()->IsMultigraph(); } bool IsMultigraph() const override { return AnyGraph()->IsMultigraph(); }
/*! /*!
* \return whether the graph is read-only * @return whether the graph is read-only
*/ */
bool IsReadonly() const override { return true; } bool IsReadonly() const override { return true; }
/** /**
* \brief Check if the graph is unibipartite. * @brief Check if the graph is unibipartite.
* *
* @return True if the graph is unibipartite. * @return True if the graph is unibipartite.
*/ */
...@@ -606,34 +606,34 @@ class ImmutableGraph : public GraphInterface { ...@@ -606,34 +606,34 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Find the predecessors of a vertex. * @brief Find the predecessors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the predecessor id array. * @return the predecessor id array.
*/ */
IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const override { IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const override {
return GetInCSR()->Successors(vid, radius); return GetInCSR()->Successors(vid, radius);
} }
/*! /*!
* \brief Find the successors of a vertex. * @brief Find the successors of a vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor * @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1). * (radius=1).
* \return the successor id array. * @return the successor id array.
*/ */
IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const override { IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const override {
return GetOutCSR()->Successors(vid, radius); return GetOutCSR()->Successors(vid, radius);
} }
/*! /*!
* \brief Get all edge ids between the two given endpoints * @brief Get all edge ids between the two given endpoints
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* \param src The source vertex. * @param src The source vertex.
* \param dst The destination vertex. * @param dst The destination vertex.
* \return the edge id array. * @return the edge id array.
*/ */
IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const override { IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const override {
if (in_csr_) { if (in_csr_) {
...@@ -644,13 +644,13 @@ class ImmutableGraph : public GraphInterface { ...@@ -644,13 +644,13 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Get all edge ids between the given endpoint pairs. * @brief Get all edge ids between the given endpoint pairs.
* \note Edges are associated with an integer id start from zero. * @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph. * The id is assigned when the edge is being added to the graph.
* If duplicate pairs exist, the returned edge IDs will also duplicate. * If duplicate pairs exist, the returned edge IDs will also duplicate.
* The order of returned edge IDs will follow the order of src-dst pairs * The order of returned edge IDs will follow the order of src-dst pairs
* first, and ties are broken by the order of edge ID. * first, and ties are broken by the order of edge ID.
* \return EdgeArray containing all edges between all pairs. * @return EdgeArray containing all edges between all pairs.
*/ */
EdgeArray EdgeIds(IdArray src, IdArray dst) const override { EdgeArray EdgeIds(IdArray src, IdArray dst) const override {
if (in_csr_) { if (in_csr_) {
...@@ -662,9 +662,9 @@ class ImmutableGraph : public GraphInterface { ...@@ -662,9 +662,9 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Find the edge ID and return the pair of endpoints * @brief Find the edge ID and return the pair of endpoints
* \param eid The edge ID * @param eid The edge ID
* \return a pair whose first element is the source and the second the * @return a pair whose first element is the source and the second the
* destination. * destination.
*/ */
std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const override { std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const override {
...@@ -672,9 +672,9 @@ class ImmutableGraph : public GraphInterface { ...@@ -672,9 +672,9 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Find the edge IDs and return their source and target node IDs. * @brief Find the edge IDs and return their source and target node IDs.
* \param eids The edge ID array. * @param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is * @return EdgeArray containing all edges with id in eid. The order is
* preserved. * preserved.
*/ */
EdgeArray FindEdges(IdArray eids) const override { EdgeArray FindEdges(IdArray eids) const override {
...@@ -682,10 +682,10 @@ class ImmutableGraph : public GraphInterface { ...@@ -682,10 +682,10 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Get the in edges of the vertex. * @brief Get the in edges of the vertex.
* \note The returned dst id array is filled with vid. * @note The returned dst id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the edges * @return the edges
*/ */
EdgeArray InEdges(dgl_id_t vid) const override { EdgeArray InEdges(dgl_id_t vid) const override {
const EdgeArray &ret = GetInCSR()->OutEdges(vid); const EdgeArray &ret = GetInCSR()->OutEdges(vid);
...@@ -693,9 +693,9 @@ class ImmutableGraph : public GraphInterface { ...@@ -693,9 +693,9 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Get the in edges of the vertices. * @brief Get the in edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray InEdges(IdArray vids) const override { EdgeArray InEdges(IdArray vids) const override {
const EdgeArray &ret = GetInCSR()->OutEdges(vids); const EdgeArray &ret = GetInCSR()->OutEdges(vids);
...@@ -703,72 +703,72 @@ class ImmutableGraph : public GraphInterface { ...@@ -703,72 +703,72 @@ class ImmutableGraph : public GraphInterface {
} }
/*! /*!
* \brief Get the out edges of the vertex. * @brief Get the out edges of the vertex.
* \note The returned src id array is filled with vid. * @note The returned src id array is filled with vid.
* \param vid The vertex id. * @param vid The vertex id.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray OutEdges(dgl_id_t vid) const override { EdgeArray OutEdges(dgl_id_t vid) const override {
return GetOutCSR()->OutEdges(vid); return GetOutCSR()->OutEdges(vid);
} }
/*! /*!
* \brief Get the out edges of the vertices. * @brief Get the out edges of the vertices.
* \param vids The vertex id array. * @param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray OutEdges(IdArray vids) const override { EdgeArray OutEdges(IdArray vids) const override {
return GetOutCSR()->OutEdges(vids); return GetOutCSR()->OutEdges(vids);
} }
/*! /*!
* \brief Get all the edges in the graph. * @brief Get all the edges in the graph.
* \note If sorted is true, the returned edges list is sorted by their src and * @note If sorted is true, the returned edges list is sorted by their src and
* dst ids. Otherwise, they are in their edge id order. * dst ids. Otherwise, they are in their edge id order.
* \param sorted Whether the returned edge list is sorted by their src and dst * @param sorted Whether the returned edge list is sorted by their src and dst
* ids. * ids.
* \return the id arrays of the two endpoints of the edges. * @return the id arrays of the two endpoints of the edges.
*/ */
EdgeArray Edges(const std::string &order = "") const override; EdgeArray Edges(const std::string &order = "") const override;
/*! /*!
* \brief Get the in degree of the given vertex. * @brief Get the in degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the in degree * @return the in degree
*/ */
uint64_t InDegree(dgl_id_t vid) const override { uint64_t InDegree(dgl_id_t vid) const override {
return GetInCSR()->OutDegree(vid); return GetInCSR()->OutDegree(vid);
} }
/*! /*!
* \brief Get the in degrees of the given vertices. * @brief Get the in degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the in degree array * @return the in degree array
*/ */
DegreeArray InDegrees(IdArray vids) const override { DegreeArray InDegrees(IdArray vids) const override {
return GetInCSR()->OutDegrees(vids); return GetInCSR()->OutDegrees(vids);
} }
/*! /*!
* \brief Get the out degree of the given vertex. * @brief Get the out degree of the given vertex.
* \param vid The vertex id. * @param vid The vertex id.
* \return the out degree * @return the out degree
*/ */
uint64_t OutDegree(dgl_id_t vid) const override { uint64_t OutDegree(dgl_id_t vid) const override {
return GetOutCSR()->OutDegree(vid); return GetOutCSR()->OutDegree(vid);
} }
/*! /*!
* \brief Get the out degrees of the given vertices. * @brief Get the out degrees of the given vertices.
* \param vid The vertex id array. * @param vid The vertex id array.
* \return the out degree array * @return the out degree array
*/ */
DegreeArray OutDegrees(IdArray vids) const override { DegreeArray OutDegrees(IdArray vids) const override {
return GetOutCSR()->OutDegrees(vids); return GetOutCSR()->OutDegrees(vids);
} }
/*! /*!
* \brief Construct the induced subgraph of the given vertices. * @brief Construct the induced subgraph of the given vertices.
* *
* The induced subgraph is a subgraph formed by specifying a set of vertices * The induced subgraph is a subgraph formed by specifying a set of vertices
* V' and then selecting all of the edges from the original graph that connect * V' and then selecting all of the edges from the original graph that connect
...@@ -781,13 +781,13 @@ class ImmutableGraph : public GraphInterface { ...@@ -781,13 +781,13 @@ class ImmutableGraph : public GraphInterface {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param vids The vertices in the subgraph. * @param vids The vertices in the subgraph.
* \return the induced subgraph * @return the induced subgraph
*/ */
Subgraph VertexSubgraph(IdArray vids) const override; Subgraph VertexSubgraph(IdArray vids) const override;
/*! /*!
* \brief Construct the induced edge subgraph of the given edges. * @brief Construct the induced edge subgraph of the given edges.
* *
* The induced edges subgraph is a subgraph formed by specifying a set of * The induced edges subgraph is a subgraph formed by specifying a set of
* edges E' and then selecting all of the nodes from the original graph that * edges E' and then selecting all of the nodes from the original graph that
...@@ -800,56 +800,56 @@ class ImmutableGraph : public GraphInterface { ...@@ -800,56 +800,56 @@ class ImmutableGraph : public GraphInterface {
* *
* The result subgraph is read-only. * The result subgraph is read-only.
* *
* \param eids The edges in the subgraph. * @param eids The edges in the subgraph.
* \return the induced edge subgraph * @return the induced edge subgraph
*/ */
Subgraph EdgeSubgraph( Subgraph EdgeSubgraph(
IdArray eids, bool preserve_nodes = false) const override; IdArray eids, bool preserve_nodes = false) const override;
/*! /*!
* \brief Return the successor vector * @brief Return the successor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the successor vector * @return the successor vector
*/ */
DGLIdIters SuccVec(dgl_id_t vid) const override { DGLIdIters SuccVec(dgl_id_t vid) const override {
return GetOutCSR()->SuccVec(vid); return GetOutCSR()->SuccVec(vid);
} }
/*! /*!
* \brief Return the out edge id vector * @brief Return the out edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the out edge id vector * @return the out edge id vector
*/ */
DGLIdIters OutEdgeVec(dgl_id_t vid) const override { DGLIdIters OutEdgeVec(dgl_id_t vid) const override {
return GetOutCSR()->OutEdgeVec(vid); return GetOutCSR()->OutEdgeVec(vid);
} }
/*! /*!
* \brief Return the predecessor vector * @brief Return the predecessor vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the predecessor vector * @return the predecessor vector
*/ */
DGLIdIters PredVec(dgl_id_t vid) const override { DGLIdIters PredVec(dgl_id_t vid) const override {
return GetInCSR()->SuccVec(vid); return GetInCSR()->SuccVec(vid);
} }
/*! /*!
* \brief Return the in edge id vector * @brief Return the in edge id vector
* \param vid The vertex id. * @param vid The vertex id.
* \return the in edge id vector * @return the in edge id vector
*/ */
DGLIdIters InEdgeVec(dgl_id_t vid) const override { DGLIdIters InEdgeVec(dgl_id_t vid) const override {
return GetInCSR()->OutEdgeVec(vid); return GetInCSR()->OutEdgeVec(vid);
} }
/*! /*!
* \brief Get the adjacency matrix of the graph. * @brief Get the adjacency matrix of the graph.
* *
* By default, a row of returned adjacency matrix represents the destination * By default, a row of returned adjacency matrix represents the destination
* of an edge and the column represents the source. * of an edge and the column represents the source.
* \param transpose A flag to transpose the returned adjacency matrix. * @param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix. * @param fmt the format of the returned adjacency matrix.
* \return a vector of three IdArray. * @return a vector of three IdArray.
*/ */
std::vector<IdArray> GetAdj( std::vector<IdArray> GetAdj(
bool transpose, const std::string &fmt) const override; bool transpose, const std::string &fmt) const override;
...@@ -863,58 +863,58 @@ class ImmutableGraph : public GraphInterface { ...@@ -863,58 +863,58 @@ class ImmutableGraph : public GraphInterface {
/* !\brief Return coo. If not exist, create from csr.*/ /* !\brief Return coo. If not exist, create from csr.*/
COOPtr GetCOO() const; COOPtr GetCOO() const;
/*! \brief Create an immutable graph from CSR. */ /*! @brief Create an immutable graph from CSR. */
static ImmutableGraphPtr CreateFromCSR( static ImmutableGraphPtr CreateFromCSR(
IdArray indptr, IdArray indices, IdArray edge_ids, IdArray indptr, IdArray indices, IdArray edge_ids,
const std::string &edge_dir); const std::string &edge_dir);
static ImmutableGraphPtr CreateFromCSR(const std::string &shared_mem_name); static ImmutableGraphPtr CreateFromCSR(const std::string &shared_mem_name);
/*! \brief Create an immutable graph from COO. */ /*! @brief Create an immutable graph from COO. */
static ImmutableGraphPtr CreateFromCOO( static ImmutableGraphPtr CreateFromCOO(
int64_t num_vertices, IdArray src, IdArray dst, bool row_osrted = false, int64_t num_vertices, IdArray src, IdArray dst, bool row_osrted = false,
bool col_sorted = false); bool col_sorted = false);
/*! /*!
* \brief Convert the given graph to an immutable graph. * @brief Convert the given graph to an immutable graph.
* *
* If the graph is already an immutable graph. The result graph will share * If the graph is already an immutable graph. The result graph will share
* the storage with the given one. * the storage with the given one.
* *
* \param graph The input graph. * @param graph The input graph.
* \return an immutable graph object. * @return an immutable graph object.
*/ */
static ImmutableGraphPtr ToImmutable(GraphPtr graph); static ImmutableGraphPtr ToImmutable(GraphPtr graph);
/*! /*!
* \brief Copy the data to another context. * @brief Copy the data to another context.
* \param ctx The target context. * @param ctx The target context.
* \return The graph under another context. * @return The graph under another context.
*/ */
static ImmutableGraphPtr CopyTo(ImmutableGraphPtr g, const DGLContext &ctx); static ImmutableGraphPtr CopyTo(ImmutableGraphPtr g, const DGLContext &ctx);
/*! /*!
* \brief Copy data to shared memory. * @brief Copy data to shared memory.
* \param name The name of the shared memory. * @param name The name of the shared memory.
* \return The graph in the shared memory * @return The graph in the shared memory
*/ */
static ImmutableGraphPtr CopyToSharedMem( static ImmutableGraphPtr CopyToSharedMem(
ImmutableGraphPtr g, const std::string &name); ImmutableGraphPtr g, const std::string &name);
/*! /*!
* \brief Convert the graph to use the given number of bits for storage. * @brief Convert the graph to use the given number of bits for storage.
* \param bits The new number of integer bits (32 or 64). * @param bits The new number of integer bits (32 or 64).
* \return The graph with new bit size storage. * @return The graph with new bit size storage.
*/ */
static ImmutableGraphPtr AsNumBits(ImmutableGraphPtr g, uint8_t bits); static ImmutableGraphPtr AsNumBits(ImmutableGraphPtr g, uint8_t bits);
/*! /*!
* \brief Return a new graph with all the edges reversed. * @brief Return a new graph with all the edges reversed.
* *
* The returned graph preserves the vertex and edge index in the original * The returned graph preserves the vertex and edge index in the original
* graph. * graph.
* *
* \return the reversed graph * @return the reversed graph
*/ */
ImmutableGraphPtr Reverse() const; ImmutableGraphPtr Reverse() const;
...@@ -933,7 +933,7 @@ class ImmutableGraph : public GraphInterface { ...@@ -933,7 +933,7 @@ class ImmutableGraph : public GraphInterface {
bool HasOutCSR() const { return out_csr_ != NULL; } bool HasOutCSR() const { return out_csr_ != NULL; }
/*! \brief Cast this graph to a heterograph */ /*! @brief Cast this graph to a heterograph */
HeteroGraphPtr AsHeteroGraph() const; HeteroGraphPtr AsHeteroGraph() const;
protected: protected:
......
/*! /*!
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* \file dgl/aten/kernel.h * @file dgl/aten/kernel.h
* \brief Sparse matrix operators. * @brief Sparse matrix operators.
*/ */
#ifndef DGL_KERNEL_H_ #ifndef DGL_KERNEL_H_
#define DGL_KERNEL_H_ #define DGL_KERNEL_H_
...@@ -18,15 +18,15 @@ namespace dgl { ...@@ -18,15 +18,15 @@ namespace dgl {
namespace aten { namespace aten {
/*! /*!
* \brief Generalized Sparse Matrix-Matrix Multiplication. * @brief Generalized Sparse Matrix-Matrix Multiplication.
* \param op The binary operator, could be `add`, `sub', `mul`, 'div', * @param op The binary operator, could be `add`, `sub', `mul`, 'div',
* `copy_u`, `copy_e'. * `copy_u`, `copy_e'.
* \param op The reduce operator, could be `sum`, `min`, `max'. * @param op The reduce operator, could be `sum`, `min`, `max'.
* \param graph The graph we apply SpMM on. * @param graph The graph we apply SpMM on.
* \param ufeat The source node feature. * @param ufeat The source node feature.
* \param efeat The edge feature. * @param efeat The edge feature.
* \param out The output feature on destination nodes. * @param out The output feature on destination nodes.
* \param out_aux A list of NDArray's that contains auxiliary information such * @param out_aux A list of NDArray's that contains auxiliary information such
* as the argmax on source nodes and edges for reduce operators such as * as the argmax on source nodes and edges for reduce operators such as
* `min` and `max`. * `min` and `max`.
*/ */
...@@ -35,20 +35,20 @@ void SpMM( ...@@ -35,20 +35,20 @@ void SpMM(
NDArray ufeat, NDArray efeat, NDArray out, std::vector<NDArray> out_aux); NDArray ufeat, NDArray efeat, NDArray out, std::vector<NDArray> out_aux);
/*! /*!
* \brief Generalized Sampled Dense-Dense Matrix Multiplication. * @brief Generalized Sampled Dense-Dense Matrix Multiplication.
* \param op The binary operator, could be `add`, `sub', `mul`, 'div', * @param op The binary operator, could be `add`, `sub', `mul`, 'div',
* `dot`, `copy_u`, `copy_e'. * `dot`, `copy_u`, `copy_e'.
* \param graph The graph we apply SpMM on. * @param graph The graph we apply SpMM on.
* \param ufeat The source node feature. * @param ufeat The source node feature.
* \param vfeat The destination node feature. * @param vfeat The destination node feature.
* \param out The output feature on edge. * @param out The output feature on edge.
*/ */
void SDDMM( void SDDMM(
const std::string& op, HeteroGraphPtr graph, NDArray ufeat, NDArray efeat, const std::string& op, HeteroGraphPtr graph, NDArray ufeat, NDArray efeat,
NDArray out); NDArray out);
/*! /*!
* \brief Sparse-sparse matrix multiplication. * @brief Sparse-sparse matrix multiplication.
* *
* The sparse matrices must have scalar weights (i.e. \a A_weights and \a * The sparse matrices must have scalar weights (i.e. \a A_weights and \a
* B_weights are 1D vectors.) * B_weights are 1D vectors.)
...@@ -57,7 +57,7 @@ std::pair<CSRMatrix, NDArray> CSRMM( ...@@ -57,7 +57,7 @@ std::pair<CSRMatrix, NDArray> CSRMM(
CSRMatrix A, NDArray A_weights, CSRMatrix B, NDArray B_weights); CSRMatrix A, NDArray A_weights, CSRMatrix B, NDArray B_weights);
/*! /*!
* \brief Summing up a list of sparse matrices. * @brief Summing up a list of sparse matrices.
* *
* The sparse matrices must have scalar weights (i.e. the arrays in \a A_weights * The sparse matrices must have scalar weights (i.e. the arrays in \a A_weights
* are 1D vectors.) * are 1D vectors.)
......
/*! /*!
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* \file dgl/lazy.h * @file dgl/lazy.h
* \brief Lazy object that will be materialized only when being queried. * @brief Lazy object that will be materialized only when being queried.
*/ */
#ifndef DGL_LAZY_H_ #ifndef DGL_LAZY_H_
#define DGL_LAZY_H_ #define DGL_LAZY_H_
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace dgl { namespace dgl {
/*! /*!
* \brief Lazy object that will be materialized only when being queried. * @brief Lazy object that will be materialized only when being queried.
* *
* The object should be immutable -- no mutation once materialized. * The object should be immutable -- no mutation once materialized.
* The object is currently not threaad safe. * The object is currently not threaad safe.
...@@ -23,7 +23,7 @@ class Lazy { ...@@ -23,7 +23,7 @@ class Lazy {
Lazy() {} Lazy() {}
/*! /*!
* \brief constructor to construct an object with given value (non-lazy case) * @brief constructor to construct an object with given value (non-lazy case)
*/ */
explicit Lazy(const T& val) : ptr_(new T(val)) {} explicit Lazy(const T& val) : ptr_(new T(val)) {}
...@@ -31,10 +31,10 @@ class Lazy { ...@@ -31,10 +31,10 @@ class Lazy {
~Lazy() = default; ~Lazy() = default;
/*! /*!
* \brief Get the value of this object. If the object has not been * @brief Get the value of this object. If the object has not been
* instantiated, using the provided function to create it. * instantiated, using the provided function to create it.
* \param fn The creator function. * @param fn The creator function.
* \return the object value. * @return the object value.
*/ */
template <typename Fn> template <typename Fn>
const T& Get(Fn fn) { const T& Get(Fn fn) {
......
/*! /*!
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* \file dgl/nodeflow.h * @file dgl/nodeflow.h
* \brief DGL NodeFlow class. * @brief DGL NodeFlow class.
*/ */
#ifndef DGL_NODEFLOW_H_ #ifndef DGL_NODEFLOW_H_
#define DGL_NODEFLOW_H_ #define DGL_NODEFLOW_H_
...@@ -18,7 +18,7 @@ namespace dgl { ...@@ -18,7 +18,7 @@ namespace dgl {
class ImmutableGraph; class ImmutableGraph;
/*! /*!
* \brief A NodeFlow graph stores the sampling results for a sampler that * @brief A NodeFlow graph stores the sampling results for a sampler that
* samples nodes/edges in layers. * samples nodes/edges in layers.
* *
* We store multiple layers of the sampling results in a single graph, which * We store multiple layers of the sampling results in a single graph, which
...@@ -26,22 +26,22 @@ class ImmutableGraph; ...@@ -26,22 +26,22 @@ class ImmutableGraph;
* node and edge mapping from the NodeFlow graph to the parent graph. * node and edge mapping from the NodeFlow graph to the parent graph.
*/ */
struct NodeFlowObject : public runtime::Object { struct NodeFlowObject : public runtime::Object {
/*! \brief The graph. */ /*! @brief The graph. */
GraphPtr graph; GraphPtr graph;
/*! /*!
* \brief the offsets of each layer. * @brief the offsets of each layer.
*/ */
IdArray layer_offsets; IdArray layer_offsets;
/*! /*!
* \brief the offsets of each flow. * @brief the offsets of each flow.
*/ */
IdArray flow_offsets; IdArray flow_offsets;
/*! /*!
* \brief The node mapping from the NodeFlow graph to the parent graph. * @brief The node mapping from the NodeFlow graph to the parent graph.
*/ */
IdArray node_mapping; IdArray node_mapping;
/*! /*!
* \brief The edge mapping from the NodeFlow graph to the parent graph. * @brief The edge mapping from the NodeFlow graph to the parent graph.
*/ */
IdArray edge_mapping; IdArray edge_mapping;
...@@ -54,14 +54,14 @@ class NodeFlow : public runtime::ObjectRef { ...@@ -54,14 +54,14 @@ class NodeFlow : public runtime::ObjectRef {
public: public:
DGL_DEFINE_OBJECT_REF_METHODS(NodeFlow, runtime::ObjectRef, NodeFlowObject); DGL_DEFINE_OBJECT_REF_METHODS(NodeFlow, runtime::ObjectRef, NodeFlowObject);
/*! \brief create a new nodeflow reference */ /*! @brief create a new nodeflow reference */
static NodeFlow Create() { static NodeFlow Create() {
return NodeFlow(std::make_shared<NodeFlowObject>()); return NodeFlow(std::make_shared<NodeFlowObject>());
} }
}; };
/*! /*!
* \brief Get a slice on a graph that represents a NodeFlow. * @brief Get a slice on a graph that represents a NodeFlow.
* *
* The entire block has to be taken as a slice. Users have to specify the * The entire block has to be taken as a slice. Users have to specify the
* correct starting and ending location of a layer. * correct starting and ending location of a layer.
...@@ -83,14 +83,14 @@ class NodeFlow : public runtime::ObjectRef { ...@@ -83,14 +83,14 @@ class NodeFlow : public runtime::ObjectRef {
* If fmt == "coo", the function returns two arrays: idx, eid. Here, the idx * If fmt == "coo", the function returns two arrays: idx, eid. Here, the idx
* array is the concatenation of src and dst node id arrays. * array is the concatenation of src and dst node id arrays.
* *
* \param graph An immutable graph. * @param graph An immutable graph.
* \param fmt the format of the returned adjacency matrix. * @param fmt the format of the returned adjacency matrix.
* \param layer0_size the size of the first layer in the block. * @param layer0_size the size of the first layer in the block.
* \param layer1_start the location where the second layer starts. * @param layer1_start the location where the second layer starts.
* \param layer1_end the location where the secnd layer ends. * @param layer1_end the location where the secnd layer ends.
* \param remap Indicates to remap all vertex ids and edge Ids to local Id * @param remap Indicates to remap all vertex ids and edge Ids to local Id
* space. * space.
* \return a vector of IdArrays. * @return a vector of IdArrays.
*/ */
std::vector<IdArray> GetNodeFlowSlice( std::vector<IdArray> GetNodeFlowSlice(
const ImmutableGraph &graph, const std::string &fmt, size_t layer0_size, const ImmutableGraph &graph, const std::string &fmt, size_t layer0_size,
......
/*! /*!
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* \file packed_func_ext.h * @file packed_func_ext.h
* \brief Extension package to PackedFunc * @brief Extension package to PackedFunc
* This enables pass ObjectRef types into/from PackedFunc. * This enables pass ObjectRef types into/from PackedFunc.
*/ */
#ifndef DGL_PACKED_FUNC_EXT_H_ #ifndef DGL_PACKED_FUNC_EXT_H_
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
namespace dgl { namespace dgl {
namespace runtime { namespace runtime {
/*! /*!
* \brief Runtime type checker for node type. * @brief Runtime type checker for node type.
* \tparam T the type to be checked. * @tparam T the type to be checked.
*/ */
template <typename T> template <typename T>
struct ObjectTypeChecker { struct ObjectTypeChecker {
......
/*! /*!
* Copyright (c) 2017 by Contributors * Copyright (c) 2017 by Contributors
* \file dgl/random.h * @file dgl/random.h
* \brief Random number generators * @brief Random number generators
*/ */
#ifndef DGL_RANDOM_H_ #ifndef DGL_RANDOM_H_
...@@ -36,36 +36,36 @@ inline uint32_t GetThreadId() { ...@@ -36,36 +36,36 @@ inline uint32_t GetThreadId() {
}; // namespace }; // namespace
/*! /*!
* \brief Thread-local Random Number Generator class * @brief Thread-local Random Number Generator class
*/ */
class RandomEngine { class RandomEngine {
public: public:
/*! \brief Constructor with default seed */ /*! @brief Constructor with default seed */
RandomEngine() { RandomEngine() {
std::random_device rd; std::random_device rd;
SetSeed(rd()); SetSeed(rd());
} }
/*! \brief Constructor with given seed */ /*! @brief Constructor with given seed */
explicit RandomEngine(uint32_t seed) { SetSeed(seed); } explicit RandomEngine(uint32_t seed) { SetSeed(seed); }
/*! \brief Get the thread-local random number generator instance */ /*! @brief Get the thread-local random number generator instance */
static RandomEngine* ThreadLocal() { static RandomEngine* ThreadLocal() {
return dmlc::ThreadLocalStore<RandomEngine>::Get(); return dmlc::ThreadLocalStore<RandomEngine>::Get();
} }
/*! /*!
* \brief Set the seed of this random number generator * @brief Set the seed of this random number generator
*/ */
void SetSeed(uint32_t seed) { rng_.seed(seed + GetThreadId()); } void SetSeed(uint32_t seed) { rng_.seed(seed + GetThreadId()); }
/*! /*!
* \brief Generate an arbitrary random 32-bit integer. * @brief Generate an arbitrary random 32-bit integer.
*/ */
int32_t RandInt32() { return static_cast<int32_t>(rng_()); } int32_t RandInt32() { return static_cast<int32_t>(rng_()); }
/*! /*!
* \brief Generate a uniform random integer in [0, upper) * @brief Generate a uniform random integer in [0, upper)
*/ */
template <typename T> template <typename T>
T RandInt(T upper) { T RandInt(T upper) {
...@@ -73,7 +73,7 @@ class RandomEngine { ...@@ -73,7 +73,7 @@ class RandomEngine {
} }
/*! /*!
* \brief Generate a uniform random integer in [lower, upper) * @brief Generate a uniform random integer in [lower, upper)
*/ */
template <typename T> template <typename T>
T RandInt(T lower, T upper) { T RandInt(T lower, T upper) {
...@@ -83,7 +83,7 @@ class RandomEngine { ...@@ -83,7 +83,7 @@ class RandomEngine {
} }
/*! /*!
* \brief Generate a uniform random float in [0, 1) * @brief Generate a uniform random float in [0, 1)
*/ */
template <typename T> template <typename T>
T Uniform() { T Uniform() {
...@@ -91,7 +91,7 @@ class RandomEngine { ...@@ -91,7 +91,7 @@ class RandomEngine {
} }
/*! /*!
* \brief Generate a uniform random float in [lower, upper) * @brief Generate a uniform random float in [lower, upper)
*/ */
template <typename T> template <typename T>
T Uniform(T lower, T upper) { T Uniform(T lower, T upper) {
...@@ -103,46 +103,46 @@ class RandomEngine { ...@@ -103,46 +103,46 @@ class RandomEngine {
} }
/*! /*!
* \brief Pick a random integer between 0 to N-1 according to given * @brief Pick a random integer between 0 to N-1 according to given
* probabilities. * probabilities.
* \tparam IdxType Return integer type. * @tparam IdxType Return integer type.
* \param prob Array of N unnormalized probability of each element. Must be * @param prob Array of N unnormalized probability of each element. Must be
* non-negative. * non-negative.
* \return An integer randomly picked from 0 to N-1. * @return An integer randomly picked from 0 to N-1.
*/ */
template <typename IdxType> template <typename IdxType>
IdxType Choice(FloatArray prob); IdxType Choice(FloatArray prob);
/*! /*!
* \brief Pick random integers between 0 to N-1 according to given * @brief Pick random integers between 0 to N-1 according to given
* probabilities * probabilities
* *
* If replace is false, the number of picked integers must not larger than N. * If replace is false, the number of picked integers must not larger than N.
* *
* \tparam IdxType Id type * @tparam IdxType Id type
* \tparam FloatType Probability value type * @tparam FloatType Probability value type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param prob Array of N unnormalized probability of each element. Must be * @param prob Array of N unnormalized probability of each element. Must be
* non-negative. * non-negative.
* \param out The output buffer to write selected indices. * @param out The output buffer to write selected indices.
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
*/ */
template <typename IdxType, typename FloatType> template <typename IdxType, typename FloatType>
void Choice(IdxType num, FloatArray prob, IdxType* out, bool replace = true); void Choice(IdxType num, FloatArray prob, IdxType* out, bool replace = true);
/*! /*!
* \brief Pick random integers between 0 to N-1 according to given * @brief Pick random integers between 0 to N-1 according to given
* probabilities * probabilities
* *
* If replace is false, the number of picked integers must not larger than N. * If replace is false, the number of picked integers must not larger than N.
* *
* \tparam IdxType Id type * @tparam IdxType Id type
* \tparam FloatType Probability value type * @tparam FloatType Probability value type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param prob Array of N unnormalized probability of each element. Must be * @param prob Array of N unnormalized probability of each element. Must be
* non-negative. * non-negative.
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
* \return Picked indices * @return Picked indices
*/ */
template <typename IdxType, typename FloatType> template <typename IdxType, typename FloatType>
IdArray Choice(IdxType num, FloatArray prob, bool replace = true) { IdArray Choice(IdxType num, FloatArray prob, bool replace = true) {
...@@ -154,30 +154,30 @@ class RandomEngine { ...@@ -154,30 +154,30 @@ class RandomEngine {
} }
/*! /*!
* \brief Pick random integers from population by uniform distribution. * @brief Pick random integers from population by uniform distribution.
* *
* If replace is false, num must not be larger than population. * If replace is false, num must not be larger than population.
* *
* \tparam IdxType Return integer type * @tparam IdxType Return integer type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param population Total number of elements to choose from. * @param population Total number of elements to choose from.
* \param out The output buffer to write selected indices. * @param out The output buffer to write selected indices.
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
*/ */
template <typename IdxType> template <typename IdxType>
void UniformChoice( void UniformChoice(
IdxType num, IdxType population, IdxType* out, bool replace = true); IdxType num, IdxType population, IdxType* out, bool replace = true);
/*! /*!
* \brief Pick random integers from population by uniform distribution. * @brief Pick random integers from population by uniform distribution.
* *
* If replace is false, num must not be larger than population. * If replace is false, num must not be larger than population.
* *
* \tparam IdxType Return integer type * @tparam IdxType Return integer type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param population Total number of elements to choose from. * @param population Total number of elements to choose from.
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
* \return Picked indices * @return Picked indices
*/ */
template <typename IdxType> template <typename IdxType>
IdArray UniformChoice(IdxType num, IdxType population, bool replace = true) { IdArray UniformChoice(IdxType num, IdxType population, bool replace = true) {
...@@ -190,7 +190,7 @@ class RandomEngine { ...@@ -190,7 +190,7 @@ class RandomEngine {
} }
/*! /*!
* \brief Pick random integers with different probability for different * @brief Pick random integers with different probability for different
* segments. * segments.
* *
* For example, if split=[0, 4, 10] and bias=[1.5, 1], it means to pick some * For example, if split=[0, 4, 10] and bias=[1.5, 1], it means to pick some
...@@ -210,13 +210,13 @@ class RandomEngine { ...@@ -210,13 +210,13 @@ class RandomEngine {
* *
* If replace is false, num must not be larger than population. * If replace is false, num must not be larger than population.
* *
* \tparam IdxType Return integer type * @tparam IdxType Return integer type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param split Array of T+1 split positions of different segments(including * @param split Array of T+1 split positions of different segments(including
* start and end) * start and end)
* \param bias Array of T weight of each segments. * @param bias Array of T weight of each segments.
* \param out The output buffer to write selected indices. * @param out The output buffer to write selected indices.
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
*/ */
template <typename IdxType, typename FloatType> template <typename IdxType, typename FloatType>
void BiasedChoice( void BiasedChoice(
...@@ -224,16 +224,16 @@ class RandomEngine { ...@@ -224,16 +224,16 @@ class RandomEngine {
bool replace = true); bool replace = true);
/*! /*!
* \brief Pick random integers with different probability for different * @brief Pick random integers with different probability for different
* segments. * segments.
* *
* If replace is false, num must not be larger than population. * If replace is false, num must not be larger than population.
* *
* \tparam IdxType Return integer type * @tparam IdxType Return integer type
* \param num Number of integers to choose * @param num Number of integers to choose
* \param split Split positions of different segments * @param split Split positions of different segments
* \param bias Weights of different segments * @param bias Weights of different segments
* \param replace If true, choose with replacement. * @param replace If true, choose with replacement.
*/ */
template <typename IdxType, typename FloatType> template <typename IdxType, typename FloatType>
IdArray BiasedChoice( IdArray BiasedChoice(
......
/*! /*!
* Copyright (c) 2017 by Contributors * Copyright (c) 2017 by Contributors
* \file dgl/runtime/c_backend_api.h * @file dgl/runtime/c_backend_api.h
* \brief DGL runtime backend API. * @brief DGL runtime backend API.
* *
* The functions defined in this header are intended to be * The functions defined in this header are intended to be
* used by compiled dgl operators, usually user do not need to use these * used by compiled dgl operators, usually user do not need to use these
...@@ -18,109 +18,109 @@ extern "C" { ...@@ -18,109 +18,109 @@ extern "C" {
// Backend related functions. // Backend related functions.
/*! /*!
* \brief Backend function for modules to get function * @brief Backend function for modules to get function
* from its environment mod_node (its imports and global function). * from its environment mod_node (its imports and global function).
* The user do should not call DGLFuncFree on func. * The user do should not call DGLFuncFree on func.
* *
* \param mod_node The module handle. * @param mod_node The module handle.
* \param func_name The name of the function. * @param func_name The name of the function.
* \param out The result function. * @param out The result function.
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
*/ */
DGL_DLL int DGLBackendGetFuncFromEnv( DGL_DLL int DGLBackendGetFuncFromEnv(
void* mod_node, const char* func_name, DGLFunctionHandle* out); void* mod_node, const char* func_name, DGLFunctionHandle* out);
/*! /*!
* \brief Backend function to register system-wide library symbol. * @brief Backend function to register system-wide library symbol.
* *
* \param name The name of the symbol * @param name The name of the symbol
* \param ptr The symbol address. * @param ptr The symbol address.
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
*/ */
DGL_DLL int DGLBackendRegisterSystemLibSymbol(const char* name, void* ptr); DGL_DLL int DGLBackendRegisterSystemLibSymbol(const char* name, void* ptr);
/*! /*!
* \brief Backend function to allocate temporal workspace. * @brief Backend function to allocate temporal workspace.
* *
* \note The result allocate spaced is ensured to be aligned to * @note The result allocate spaced is ensured to be aligned to
* kTempAllocaAlignment. * kTempAllocaAlignment.
* *
* \param nbytes The size of the space requested. * @param nbytes The size of the space requested.
* \param device_type The device type which the space will be allocated. * @param device_type The device type which the space will be allocated.
* \param device_id The device id which the space will be allocated. * @param device_id The device id which the space will be allocated.
* \param dtype_code_hint The type code of the array elements. Only used in * @param dtype_code_hint The type code of the array elements. Only used in
* certain backends such as OpenGL. * certain backends such as OpenGL.
* \param dtype_bits_hint The type bits of the array elements. Only used in * @param dtype_bits_hint The type bits of the array elements. Only used in
* certain backends such as OpenGL. * certain backends such as OpenGL.
* \return nullptr when error is thrown, a valid ptr if success * @return nullptr when error is thrown, a valid ptr if success
*/ */
DGL_DLL void* DGLBackendAllocWorkspace( DGL_DLL void* DGLBackendAllocWorkspace(
int device_type, int device_id, uint64_t nbytes, int dtype_code_hint, int device_type, int device_id, uint64_t nbytes, int dtype_code_hint,
int dtype_bits_hint); int dtype_bits_hint);
/*! /*!
* \brief Backend function to free temporal workspace. * @brief Backend function to free temporal workspace.
* *
* \param ptr The result allocated space pointer. * @param ptr The result allocated space pointer.
* \param device_type The device type which the space will be allocated. * @param device_type The device type which the space will be allocated.
* \param device_id The device id which the space will be allocated. * @param device_id The device id which the space will be allocated.
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
* *
* \sa DGLBackendAllocWorkspace * \sa DGLBackendAllocWorkspace
*/ */
DGL_DLL int DGLBackendFreeWorkspace(int device_type, int device_id, void* ptr); DGL_DLL int DGLBackendFreeWorkspace(int device_type, int device_id, void* ptr);
/*! /*!
* \brief Environment for DGL parallel task. * @brief Environment for DGL parallel task.
*/ */
typedef struct { typedef struct {
/*! /*!
* \brief Auxiliary used for synchronization * @brief Auxiliary used for synchronization
*/ */
void* sync_handle; void* sync_handle;
/*! \brief total amount of task */ /*! @brief total amount of task */
int32_t num_task; int32_t num_task;
} DGLParallelGroupEnv; } DGLParallelGroupEnv;
/*! /*!
* \brief The callback function to execute a parallel lambda * @brief The callback function to execute a parallel lambda
* \param task_id the task id of the function. * @param task_id the task id of the function.
* \param penv The parallel environment backs the execution. * @param penv The parallel environment backs the execution.
* \param cdata The supporting closure data. * @param cdata The supporting closure data.
*/ */
typedef int (*FDGLParallelLambda)( typedef int (*FDGLParallelLambda)(
int task_id, DGLParallelGroupEnv* penv, void* cdata); int task_id, DGLParallelGroupEnv* penv, void* cdata);
/*! /*!
* \brief Backend function for running parallel jobs. * @brief Backend function for running parallel jobs.
* *
* \param flambda The parallel function to be launched. * @param flambda The parallel function to be launched.
* \param cdata The closure data. * @param cdata The closure data.
* \param num_task Number of tasks to launch, can be 0, means launch * @param num_task Number of tasks to launch, can be 0, means launch
* with all available threads. * with all available threads.
* *
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
*/ */
DGL_DLL int DGLBackendParallelLaunch( DGL_DLL int DGLBackendParallelLaunch(
FDGLParallelLambda flambda, void* cdata, int num_task); FDGLParallelLambda flambda, void* cdata, int num_task);
/*! /*!
* \brief BSP barrrier between parallel threads * @brief BSP barrrier between parallel threads
* \param task_id the task id of the function. * @param task_id the task id of the function.
* \param penv The parallel environment backs the execution. * @param penv The parallel environment backs the execution.
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
*/ */
DGL_DLL int DGLBackendParallelBarrier(int task_id, DGLParallelGroupEnv* penv); DGL_DLL int DGLBackendParallelBarrier(int task_id, DGLParallelGroupEnv* penv);
/*! /*!
* \brief Simple static initialization fucntion. * @brief Simple static initialization fucntion.
* Run f once and set handle to be not null. * Run f once and set handle to be not null.
* This function is mainly used for test purpose. * This function is mainly used for test purpose.
* *
* \param handle An global address to indicate f * @param handle An global address to indicate f
* \param f The function to be ran * @param f The function to be ran
* \param cdata The closure data to pass to the function. * @param cdata The closure data to pass to the function.
* \param nbytes Number of bytes in the closure data. * @param nbytes Number of bytes in the closure data.
* \return 0 when no error is thrown, -1 when failure happens * @return 0 when no error is thrown, -1 when failure happens
*/ */
DGL_DLL int DGLBackendRunOnce( DGL_DLL int DGLBackendRunOnce(
void** handle, int (*f)(void*), void* cdata, int nbytes); void** handle, int (*f)(void*), void* cdata, int nbytes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment