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
......
This diff is collapsed.
/*! /*!
* 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,
......
This diff is collapsed.
/*! /*!
* 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