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
* \file featgraph/include/featgraph.h
* \brief FeatGraph kernel headers.
* @file featgraph/include/featgraph.h
* @brief FeatGraph kernel headers.
*/
#ifndef FEATGRAPH_H_
#define FEATGRAPH_H_
......@@ -11,10 +11,10 @@
namespace dgl {
namespace featgraph {
/* \brief Load Featgraph module from given path. */
/* @brief Load Featgraph module from given path. */
void LoadFeatGraphModule(const std::string& path);
/* \brief Call Featgraph's SDDMM kernel. */
/* @brief Call Featgraph's SDDMM kernel. */
void SDDMMTreeReduction(
DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs,
DLManagedTensor* rhs, DLManagedTensor* out);
......
/*!
* Copyright (c) 2020 by Contributors
* \file featgraph/src/featgraph.cc
* \brief FeatGraph kernels.
* @file featgraph/src/featgraph.cc
* @brief FeatGraph kernels.
*/
#include <dmlc/logging.h>
#include <featgraph.h>
......@@ -12,7 +12,7 @@
namespace dgl {
namespace featgraph {
/* \brief Singleton that loads the featgraph module. */
/* @brief Singleton that loads the featgraph module. */
class FeatGraphModule {
public:
static FeatGraphModule* Global() {
......@@ -38,12 +38,12 @@ class FeatGraphModule {
FeatGraphModule() {}
};
/* \brief Load Featgraph module from given path. */
/* @brief Load Featgraph module from given path. */
void LoadFeatGraphModule(const std::string& path) {
FeatGraphModule::Global()->Load(path);
}
/* \brief Convert DLDataType to string. */
/* @brief Convert DLDataType to string. */
inline std::string DTypeAsStr(const DLDataType& t) {
switch (t.code) {
case 0U:
......@@ -59,14 +59,14 @@ inline std::string DTypeAsStr(const DLDataType& t) {
}
}
/* \brief Get operator filename. */
/* @brief Get operator filename. */
inline std::string GetOperatorName(
const std::string& base_name, const DLDataType& dtype,
const DLDataType& idtype) {
return base_name + "_" + DTypeAsStr(dtype) + "_" + DTypeAsStr(idtype);
}
/* \brief Call FeatGraph's SDDMM kernel. */
/* @brief Call FeatGraph's SDDMM kernel. */
void SDDMMTreeReduction(
DLManagedTensor* row, DLManagedTensor* col, DLManagedTensor* lhs,
DLManagedTensor* rhs, DLManagedTensor* out) {
......
......@@ -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
* include in your project.
......
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/array.h
* \brief Common array operations required by DGL.
* @file dgl/array.h
* @brief Common array operations required by DGL.
*
* 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.
......
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/array_iterator.h
* \brief Various iterators.
* @file dgl/array_iterator.h
* @brief Various iterators.
*/
#ifndef DGL_ARRAY_ITERATOR_H_
#define DGL_ARRAY_ITERATOR_H_
......
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/aten/spmat.h
* \brief Sparse matrix definitions
* @file dgl/aten/spmat.h
* @brief Sparse matrix definitions
*/
#ifndef DGL_ATEN_SPMAT_H_
#define DGL_ATEN_SPMAT_H_
......@@ -15,7 +15,7 @@
namespace dgl {
/*!
* \brief Sparse format.
* @brief Sparse format.
*/
enum class SparseFormat {
kCOO = 1,
......@@ -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 ANY_CODE = 0x0;
......
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/aten/types.h
* \brief Array and ID types
* @file dgl/aten/types.h
* @brief Array and ID types
*/
#ifndef DGL_ATEN_TYPES_H_
#define DGL_ATEN_TYPES_H_
......@@ -14,7 +14,7 @@ namespace dgl {
typedef uint64_t dgl_id_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.
*
* Suppose the binary representation is xyz, then
......
This diff is collapsed.
/*!
* Copyright (c) 2020 by Contributors * \file dgl/aten/bcast.h
* \brief Broadcast related function C++ header.
* Copyright (c) 2020 by Contributors
* @file dgl/aten/bcast.h
* @brief Broadcast related function C++ header.
*/
#ifndef DGL_BCAST_H_
#define DGL_BCAST_H_
......@@ -14,12 +15,12 @@ using namespace dgl::runtime;
namespace dgl {
/*!
* \brief Broadcast offsets and auxiliary information.
* @brief Broadcast offsets and auxiliary information.
*/
struct BcastOff {
/*!
* \brief offset vector of lhs operand and rhs operand.
* \note lhs_offset[i] indicates the start position of the scalar
* @brief offset vector of lhs operand and rhs operand.
* @note lhs_offset[i] indicates the start position of the scalar
* in lhs operand that required to compute the i-th element
* in the output, likewise for rhs_offset.
*
......@@ -35,11 +36,11 @@ struct BcastOff {
* rhs array.
*/
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;
/*!
* \brief Auxiliary information for kernel computation
* \note lhs_len refers to the left hand side operand length.
* @brief Auxiliary information for kernel computation
* @note lhs_len refers to the left hand side operand length.
* e.g. 15 for shape (1, 3, 5)
* rhs_len refers to the right hand side operand length.
* e.g. 15 for shape (3, 1, 5)
......@@ -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.
* \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`.
* \param lhs The left hand side operand of NDArray class.
* \param rhs The right hand side operand of NDArray class.
* \return the broadcast information of BcastOff class.
* @param lhs The left hand side operand of NDArray class.
* @param rhs The right hand side operand of NDArray class.
* @return the broadcast information of BcastOff class.
*/
BcastOff CalcBcastOff(const std::string& op, NDArray lhs, NDArray rhs);
......
/*!
* Copyright (c) 2018 by Contributors
* \file dgl/graph.h
* \brief DGL graph index class.
* @file dgl/graph.h
* @brief DGL graph index class.
*/
#ifndef DGL_GRAPH_H_
#define DGL_GRAPH_H_
......@@ -21,20 +21,20 @@ class Graph;
class GraphOp;
typedef std::shared_ptr<Graph> MutableGraphPtr;
/*! \brief Mutable graph based on adjacency list. */
/*! @brief Mutable graph based on adjacency list. */
class Graph : public GraphInterface {
public:
/*! \brief default constructor */
/*! @brief default constructor */
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);
/*! \brief default copy constructor */
/*! @brief default copy constructor */
Graph(const Graph& other) = default;
#ifndef _MSC_VER
/*! \brief default move constructor */
/*! @brief default move constructor */
Graph(Graph&& other) = default;
#else
Graph(Graph&& other) {
......@@ -48,36 +48,36 @@ class Graph : public GraphInterface {
}
#endif // _MSC_VER
/*! \brief default assign constructor */
/*! @brief default assign constructor */
Graph& operator=(const Graph& other) = default;
/*! \brief default destructor */
/*! @brief default destructor */
~Graph() = default;
/*!
* \brief Add vertices to the graph.
* \note Since vertices are integers enumerated from zero, only the number of
* @brief Add vertices to the graph.
* @note Since vertices are integers enumerated from zero, only the number of
* 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;
/*!
* \brief Add one edge to the graph.
* \param src The source vertex.
* \param dst The destination vertex.
* @brief Add one edge to the graph.
* @param src The source vertex.
* @param dst The destination vertex.
*/
void AddEdge(dgl_id_t src, dgl_id_t dst) override;
/*!
* \brief Add edges to the graph.
* \param src_ids The source vertex id array.
* \param dst_ids The destination vertex id array.
* @brief Add edges to the graph.
* @param src_ids The source vertex id array.
* @param dst_ids The destination vertex id array.
*/
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 {
adjlist_.clear();
......@@ -93,13 +93,13 @@ class Graph : public GraphInterface {
uint8_t NumBits() const override { return 64; }
/*!
* \note not const since we have caches
* \return whether the graph is a multigraph
* @note not const since we have caches
* @return whether the graph is a multigraph
*/
bool IsMultigraph() const override;
/*!
* \return whether the graph is read-only
* @return whether the graph is read-only
*/
bool IsReadonly() const override { return false; }
......@@ -121,48 +121,48 @@ class Graph : public GraphInterface {
BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const override;
/*!
* \brief Find the predecessors of a vertex.
* \param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor
* @brief Find the predecessors of a vertex.
* @param vid The vertex id.
* @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1).
* \return the predecessor id array.
* @return the predecessor id array.
*/
IdArray Predecessors(dgl_id_t vid, uint64_t radius = 1) const override;
/*!
* \brief Find the successors of a vertex.
* \param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor
* @brief Find the successors of a vertex.
* @param vid The vertex id.
* @param radius The radius of the neighborhood. Default is immediate neighbor
* (radius=1).
* \return the successor id array.
* @return the successor id array.
*/
IdArray Successors(dgl_id_t vid, uint64_t radius = 1) const override;
/*!
* \brief Get all edge ids between the two given endpoints
* \note Edges are associated with an integer id start from zero.
* @brief Get all edge ids between the two given endpoints
* @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph.
* \param src The source vertex.
* \param dst The destination vertex.
* \return the edge id array.
* @param src The source vertex.
* @param dst The destination vertex.
* @return the edge id array.
*/
IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const override;
/*!
* \brief Get all edge ids between the given endpoint pairs.
* \note Edges are associated with an integer id start from zero.
* @brief Get all edge ids between the given endpoint pairs.
* @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph.
* 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
* 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;
/*!
* \brief Find the edge ID and return the pair of endpoints
* \param eid The edge ID
* \return a pair whose first element is the source and the second the
* @brief Find the edge ID and return the pair of endpoints
* @param eid The edge ID
* @return a pair whose first element is the source and the second the
* destination.
*/
std::pair<dgl_id_t, dgl_id_t> FindEdge(dgl_id_t eid) const override {
......@@ -170,57 +170,57 @@ class Graph : public GraphInterface {
}
/*!
* \brief Find the edge IDs and return their source and target node IDs.
* \param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is
* @brief Find the edge IDs and return their source and target node IDs.
* @param eids The edge ID array.
* @return EdgeArray containing all edges with id in eid. The order is
* preserved.
*/
EdgeArray FindEdges(IdArray eids) const override;
/*!
* \brief Get the in edges of the vertex.
* \note The returned dst id array is filled with vid.
* \param vid The vertex id.
* \return the edges
* @brief Get the in edges of the vertex.
* @note The returned dst id array is filled with vid.
* @param vid The vertex id.
* @return the edges
*/
EdgeArray InEdges(dgl_id_t vid) const override;
/*!
* \brief Get the in edges of the vertices.
* \param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the in edges of the vertices.
* @param vids The vertex id array.
* @return the id arrays of the two endpoints of the edges.
*/
EdgeArray InEdges(IdArray vids) const override;
/*!
* \brief Get the out edges of the vertex.
* \note The returned src id array is filled with vid.
* \param vid The vertex id.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the out edges of the vertex.
* @note The returned src id array is filled with vid.
* @param vid The vertex id.
* @return the id arrays of the two endpoints of the edges.
*/
EdgeArray OutEdges(dgl_id_t vid) const override;
/*!
* \brief Get the out edges of the vertices.
* \param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the out edges of the vertices.
* @param vids The vertex id array.
* @return the id arrays of the two endpoints of the edges.
*/
EdgeArray OutEdges(IdArray vids) const override;
/*!
* \brief Get all the edges in the graph.
* \note If sorted is true, the returned edges list is sorted by their src and
* @brief Get all the edges in the graph.
* @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.
* \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.
* \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;
/*!
* \brief Get the in degree of the given vertex.
* \param vid The vertex id.
* \return the in degree
* @brief Get the in degree of the given vertex.
* @param vid The vertex id.
* @return the in degree
*/
uint64_t InDegree(dgl_id_t vid) const override {
CHECK(HasVertex(vid)) << "invalid vertex: " << vid;
......@@ -228,16 +228,16 @@ class Graph : public GraphInterface {
}
/*!
* \brief Get the in degrees of the given vertices.
* \param vid The vertex id array.
* \return the in degree array
* @brief Get the in degrees of the given vertices.
* @param vid The vertex id array.
* @return the in degree array
*/
DegreeArray InDegrees(IdArray vids) const override;
/*!
* \brief Get the out degree of the given vertex.
* \param vid The vertex id.
* \return the out degree
* @brief Get the out degree of the given vertex.
* @param vid The vertex id.
* @return the out degree
*/
uint64_t OutDegree(dgl_id_t vid) const override {
CHECK(HasVertex(vid)) << "invalid vertex: " << vid;
......@@ -245,14 +245,14 @@ class Graph : public GraphInterface {
}
/*!
* \brief Get the out degrees of the given vertices.
* \param vid The vertex id array.
* \return the out degree array
* @brief Get the out degrees of the given vertices.
* @param vid The vertex id array.
* @return the out degree array
*/
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
* V' and then selecting all of the edges from the original graph that connect
......@@ -265,13 +265,13 @@ class Graph : public GraphInterface {
*
* The result subgraph is read-only.
*
* \param vids The vertices in the subgraph.
* \return the induced subgraph
* @param vids The vertices in the subgraph.
* @return the induced subgraph
*/
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
* edges E' and then selecting all of the nodes from the original graph that
......@@ -284,16 +284,16 @@ class Graph : public GraphInterface {
*
* The result subgraph is read-only.
*
* \param eids The edges in the subgraph.
* \return the induced edge subgraph
* @param eids The edges in the subgraph.
* @return the induced edge subgraph
*/
Subgraph EdgeSubgraph(
IdArray eids, bool preserve_nodes = false) const override;
/*!
* \brief Return the successor vector
* \param vid The vertex id.
* \return the successor vector
* @brief Return the successor vector
* @param vid The vertex id.
* @return the successor vector
*/
DGLIdIters SuccVec(dgl_id_t vid) const override {
auto data = adjlist_[vid].succ.data();
......@@ -302,9 +302,9 @@ class Graph : public GraphInterface {
}
/*!
* \brief Return the out edge id vector
* \param vid The vertex id.
* \return the out edge id vector
* @brief Return the out edge id vector
* @param vid The vertex id.
* @return the out edge id vector
*/
DGLIdIters OutEdgeVec(dgl_id_t vid) const override {
auto data = adjlist_[vid].edge_id.data();
......@@ -313,9 +313,9 @@ class Graph : public GraphInterface {
}
/*!
* \brief Return the predecessor vector
* \param vid The vertex id.
* \return the predecessor vector
* @brief Return the predecessor vector
* @param vid The vertex id.
* @return the predecessor vector
*/
DGLIdIters PredVec(dgl_id_t vid) const override {
auto data = reverse_adjlist_[vid].succ.data();
......@@ -324,9 +324,9 @@ class Graph : public GraphInterface {
}
/*!
* \brief Return the in edge id vector
* \param vid The vertex id.
* \return the in edge id vector
* @brief Return the in edge id vector
* @param vid The vertex id.
* @return the in edge id vector
*/
DGLIdIters InEdgeVec(dgl_id_t vid) const override {
auto data = reverse_adjlist_[vid].edge_id.data();
......@@ -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
* of an edge and the column represents the source.
* \param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix.
* \return a vector of three IdArray.
* @param transpose A flag to transpose the returned adjacency matrix.
* @param fmt the format of the returned adjacency matrix.
* @return a vector of three IdArray.
*/
std::vector<IdArray> GetAdj(
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>(); }
/*! \brief Create from coo */
/*! @brief Create from coo */
static MutableGraphPtr CreateFromCOO(
int64_t num_nodes, IdArray src_ids, IdArray dst_ids) {
return std::make_shared<Graph>(src_ids, dst_ids, num_nodes);
......@@ -357,29 +357,29 @@ class Graph : public GraphInterface {
protected:
friend class GraphOp;
/*! \brief Internal edge list type */
/*! @brief Internal edge list type */
struct EdgeList {
/*! \brief successor vertex list */
/*! @brief successor vertex list */
std::vector<dgl_id_t> succ;
/*! \brief out edge list */
/*! @brief out edge list */
std::vector<dgl_id_t> edge_id;
};
typedef std::vector<EdgeList> AdjacencyList;
/*! \brief adjacency list using vector storage */
/*! @brief adjacency list using vector storage */
AdjacencyList adjlist_;
/*! \brief reverse adjacency list using vector storage */
/*! @brief reverse adjacency list using vector storage */
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_;
/*! \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_;
/*! \brief read only flag */
/*! @brief read only flag */
bool read_only_ = false;
/*! \brief number of edges */
/*! @brief number of edges */
uint64_t num_edges_ = 0;
};
......
/*!
* Copyright (c) 2018 by Contributors
* \file dgl/graph_interface.h
* \brief DGL graph index class.
* @file dgl/graph_interface.h
* @brief DGL graph index class.
*/
#ifndef DGL_GRAPH_INTERFACE_H_
#define DGL_GRAPH_INTERFACE_H_
......@@ -20,7 +20,7 @@ namespace dgl {
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.
* but it doesn't own data itself. instead, it only references data in
......@@ -45,7 +45,7 @@ class DGLIdIters {
};
/*!
* \brief int32 version for DGLIdIters
* @brief int32 version for DGLIdIters
*
*/
class DGLIdIters32 {
......@@ -66,9 +66,9 @@ class DGLIdIters32 {
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 {
/* \brief the two endpoints and the id of the edge */
/* @brief the two endpoints and the id of the edge */
IdArray src, dst, id;
} EdgeArray;
......@@ -79,7 +79,7 @@ class GraphInterface;
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.
*
......@@ -94,50 +94,50 @@ class GraphInterface : public runtime::Object {
virtual ~GraphInterface() = default;
/*!
* \brief Add vertices to the graph.
* \note Since vertices are integers enumerated from zero, only the number of
* @brief Add vertices to the graph.
* @note Since vertices are integers enumerated from zero, only the number of
* 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;
/*!
* \brief Add one edge to the graph.
* \param src The source vertex.
* \param dst The destination vertex.
* @brief Add one edge to the graph.
* @param src The source vertex.
* @param dst The destination vertex.
*/
virtual void AddEdge(dgl_id_t src, dgl_id_t dst) = 0;
/*!
* \brief Add edges to the graph.
* \param src_ids The source vertex id array.
* \param dst_ids The destination vertex id array.
* @brief Add edges to the graph.
* @param src_ids The source vertex id array.
* @param dst_ids The destination vertex id array.
*/
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;
/*!
* \brief Get the device context of this graph.
* @brief Get the device context of this graph.
*/
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).
*/
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;
/*!
* \return whether the graph is unibipartite
* @return whether the graph is unibipartite
*/
virtual bool IsUniBipartite() const {
EdgeArray edges = Edges();
......@@ -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;
......@@ -193,130 +193,130 @@ class GraphInterface : public runtime::Object {
virtual BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const = 0;
/*!
* \brief Find the predecessors of a vertex.
* \param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor
* @brief Find the predecessors of a vertex.
* @param vid The vertex id.
* @param radius The radius of the neighborhood. Default is immediate neighbor
* (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;
/*!
* \brief Find the successors of a vertex.
* \param vid The vertex id.
* \param radius The radius of the neighborhood. Default is immediate neighbor
* @brief Find the successors of a vertex.
* @param vid The vertex id.
* @param radius The radius of the neighborhood. Default is immediate neighbor
* (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;
/*!
* \brief Get all edge ids between the two given endpoints
* \note Edges are associated with an integer id start from zero.
* @brief Get all edge ids between the two given endpoints
* @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph.
* \param src The source vertex.
* \param dst The destination vertex.
* \return the edge id array.
* @param src The source vertex.
* @param dst The destination vertex.
* @return the edge id array.
*/
virtual IdArray EdgeId(dgl_id_t src, dgl_id_t dst) const = 0;
/*!
* \brief Get all edge ids between the given endpoint pairs.
* \note Edges are associated with an integer id start from zero.
* @brief Get all edge ids between the given endpoint pairs.
* @note Edges are associated with an integer id start from zero.
* The id is assigned when the edge is being added to the graph.
* 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
* 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;
/*!
* \brief Find the edge ID and return the pair of endpoints
* \param eid The edge ID
* \return a pair whose first element is the source and the second the
* @brief Find the edge ID and return the pair of endpoints
* @param eid The edge ID
* @return a pair whose first element is the source and the second the
* destination.
*/
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.
* \param eids The edge ID array.
* \return EdgeArray containing all edges with id in eid. The order is
* @brief Find the edge IDs and return their source and target node IDs.
* @param eids The edge ID array.
* @return EdgeArray containing all edges with id in eid. The order is
* preserved.
*/
virtual EdgeArray FindEdges(IdArray eids) const = 0;
/*!
* \brief Get the in edges of the vertex.
* \note The returned dst id array is filled with vid.
* \param vid The vertex id.
* \return the edges
* @brief Get the in edges of the vertex.
* @note The returned dst id array is filled with vid.
* @param vid The vertex id.
* @return the edges
*/
virtual EdgeArray InEdges(dgl_id_t vid) const = 0;
/*!
* \brief Get the in edges of the vertices.
* \param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the in edges of the vertices.
* @param vids The vertex id array.
* @return the id arrays of the two endpoints of the edges.
*/
virtual EdgeArray InEdges(IdArray vids) const = 0;
/*!
* \brief Get the out edges of the vertex.
* \note The returned src id array is filled with vid.
* \param vid The vertex id.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the out edges of the vertex.
* @note The returned src id array is filled with vid.
* @param vid The vertex id.
* @return the id arrays of the two endpoints of the edges.
*/
virtual EdgeArray OutEdges(dgl_id_t vid) const = 0;
/*!
* \brief Get the out edges of the vertices.
* \param vids The vertex id array.
* \return the id arrays of the two endpoints of the edges.
* @brief Get the out edges of the vertices.
* @param vids The vertex id array.
* @return the id arrays of the two endpoints of the edges.
*/
virtual EdgeArray OutEdges(IdArray vids) const = 0;
/*!
* \brief Get all the edges in the graph.
* \note If order is "srcdst", the returned edges list is sorted by their src
* @brief Get all the edges in the graph.
* @note If order is "srcdst", the returned edges list is sorted by their src
* and dst ids. If order is "eid", they are in their edge id order.
* Otherwise, in the arbitrary order.
* \param order The order of the returned edge list.
* \return the id arrays of the two endpoints of the edges.
* @param order The order of the returned edge list.
* @return the id arrays of the two endpoints of the edges.
*/
virtual EdgeArray Edges(const std::string &order = "") const = 0;
/*!
* \brief Get the in degree of the given vertex.
* \param vid The vertex id.
* \return the in degree
* @brief Get the in degree of the given vertex.
* @param vid The vertex id.
* @return the in degree
*/
virtual uint64_t InDegree(dgl_id_t vid) const = 0;
/*!
* \brief Get the in degrees of the given vertices.
* \param vid The vertex id array.
* \return the in degree array
* @brief Get the in degrees of the given vertices.
* @param vid The vertex id array.
* @return the in degree array
*/
virtual DegreeArray InDegrees(IdArray vids) const = 0;
/*!
* \brief Get the out degree of the given vertex.
* \param vid The vertex id.
* \return the out degree
* @brief Get the out degree of the given vertex.
* @param vid The vertex id.
* @return the out degree
*/
virtual uint64_t OutDegree(dgl_id_t vid) const = 0;
/*!
* \brief Get the out degrees of the given vertices.
* \param vid The vertex id array.
* \return the out degree array
* @brief Get the out degrees of the given vertices.
* @param vid The vertex id array.
* @return the out degree array
*/
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
* V' and then selecting all of the edges from the original graph that connect
......@@ -329,13 +329,13 @@ class GraphInterface : public runtime::Object {
*
* The result subgraph is read-only.
*
* \param vids The vertices in the subgraph.
* \return the induced subgraph
* @param vids The vertices in the subgraph.
* @return the induced subgraph
*/
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
* edges E' and then selecting all of the nodes from the original graph that
......@@ -348,44 +348,44 @@ class GraphInterface : public runtime::Object {
*
* The result subgraph is read-only.
*
* \param eids The edges in the subgraph.
* \param preserve_nodes If true, the vertices will not be relabeled, so some
* @param eids The edges in the subgraph.
* @param preserve_nodes If true, the vertices will not be relabeled, so some
* vertices may have no incident edges.
* \return the induced edge subgraph
* @return the induced edge subgraph
*/
virtual Subgraph EdgeSubgraph(
IdArray eids, bool preserve_nodes = false) const = 0;
/*!
* \brief Return the successor vector
* \param vid The vertex id.
* \return the successor vector iterator pair.
* @brief Return the successor vector
* @param vid The vertex id.
* @return the successor vector iterator pair.
*/
virtual DGLIdIters SuccVec(dgl_id_t vid) const = 0;
/*!
* \brief Return the out edge id vector
* \param vid The vertex id.
* \return the out edge id vector iterator pair.
* @brief Return the out edge id vector
* @param vid The vertex id.
* @return the out edge id vector iterator pair.
*/
virtual DGLIdIters OutEdgeVec(dgl_id_t vid) const = 0;
/*!
* \brief Return the predecessor vector
* \param vid The vertex id.
* \return the predecessor vector iterator pair.
* @brief Return the predecessor vector
* @param vid The vertex id.
* @return the predecessor vector iterator pair.
*/
virtual DGLIdIters PredVec(dgl_id_t vid) const = 0;
/*!
* \brief Return the in edge id vector
* \param vid The vertex id.
* \return the in edge id vector iterator pair.
* @brief Return the in edge id vector
* @param vid The vertex id.
* @return the in edge id vector iterator pair.
*/
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
* of an edge and the column represents the source.
......@@ -396,15 +396,15 @@ class GraphInterface : public runtime::Object {
* If the fmt is 'coo', the function should return one array of shape (2,
* nnz), representing a horitonzal stack of row and col indices.
*
* \param transpose A flag to transpose the returned adjacency matrix.
* \param fmt the format of the returned adjacency matrix.
* \return a vector of IdArrays.
* @param transpose A flag to transpose the returned adjacency matrix.
* @param fmt the format of the returned adjacency matrix.
* @return a vector of IdArrays.
*/
virtual std::vector<IdArray> GetAdj(
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.
* The edge ids should be sorted accordingly.
......@@ -418,19 +418,19 @@ class GraphInterface : public runtime::Object {
// Define GraphRef
DGL_DEFINE_OBJECT_REF(GraphRef, GraphInterface);
/*! \brief Subgraph data structure */
/*! @brief Subgraph data structure */
struct Subgraph : public runtime::Object {
/*! \brief The graph. */
/*! @brief The graph. */
GraphPtr graph;
/*!
* \brief The induced vertex ids.
* \note This is also a map from the new vertex id to the vertex id in the
* @brief The induced vertex ids.
* @note This is also a map from the new vertex id to the vertex id in the
* parent graph.
*/
IdArray induced_vertices;
/*!
* \brief The induced edge ids.
* \note This is also a map from the new edge id to the edge id in the parent
* @brief The induced edge ids.
* @note This is also a map from the new edge id to the edge id in the parent
* graph.
*/
IdArray induced_edges;
......@@ -439,21 +439,21 @@ struct Subgraph : public 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 {
/*! \brief The existence of the negative edges in the parent graph. */
/*! @brief The existence of the negative edges in the parent graph. */
IdArray exist;
/*! \brief The Ids of head nodes */
/*! @brief The Ids of head nodes */
IdArray head_nid;
/*! \brief The Ids of tail nodes */
/*! @brief The Ids of tail nodes */
IdArray tail_nid;
};
/*! \brief Subgraph data structure for halo subgraph */
/*! @brief Subgraph data structure for halo 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;
};
......
/*!
* Copyright (c) 2018 by Contributors
* \file dgl/graph_op.h
* \brief Operations on graph index.
* @file dgl/graph_op.h
* @brief Operations on graph index.
*/
#ifndef DGL_GRAPH_OP_H_
#define DGL_GRAPH_OP_H_
......@@ -16,30 +16,30 @@ namespace dgl {
class GraphOp {
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
* graph.
*
* \return the reversed graph
* @return the reversed 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
* (i,j)~(j,i) and (j,i)~(i,j) are the "backtracking" edges on
* the line graph.
*
* \param graph The input graph.
* \param backtracking Whether the backtracking edges are included or not
* \return the line graph
* @param graph The input graph.
* @param backtracking Whether the backtracking edges are included or not
* @return the line graph
*/
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.
* Nodes/Edges will be relabled by adding the cumsum of the previous graph
......@@ -50,13 +50,13 @@ class GraphOp {
* 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.
*
* \param graphs A list of input graphs to be unioned.
* \return the disjoint union of the graphs
* @param graphs A list of input graphs to be unioned.
* @return the disjoint union of the 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
* into num graphs. This requires the given number of partitions to evenly
......@@ -65,15 +65,15 @@ class GraphOp {
* If the input graph is mutable, the result graphs are mutable.
* If the input graph is immutable, the result graphs are immutable.
*
* \param graph The graph to be partitioned.
* \param num The number of partitions.
* \return a list of partitioned graphs
* @param graph The graph to be partitioned.
* @param num The number of partitions.
* @return a list of partitioned graphs
*/
static std::vector<GraphPtr> DisjointPartitionByNum(
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
* based on the given sizes. This requires the sum of the given sizes is equal
......@@ -82,28 +82,28 @@ class GraphOp {
* If the input graph is mutable, the result graphs are mutable.
* If the input graph is immutable, the result graphs are immutable.
*
* \param graph The graph to be partitioned.
* \param sizes The number of partitions.
* \return a list of partitioned graphs
* @param graph The graph to be partitioned.
* @param sizes The number of partitions.
* @return a list of partitioned graphs
*/
static std::vector<GraphPtr> DisjointPartitionBySizes(
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.
*
* \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 indices indicate the vertex Ids in the subgraph.
* \param query The vertex Ids in the parent graph.
* \return an Id array that contains the subgraph node Ids.
* @param query The vertex Ids in the parent graph.
* @return an Id array that contains the subgraph node Ids.
*/
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,
* ids: [0, 1, 2, 3, 4],
......@@ -112,68 +112,68 @@ class GraphOp {
* 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.
*
* \param ids An array that contains the node or edge Ids.
* \param offset An array that contains the offset after expansion.
* \return a expanded Id array.
* @param ids An array that contains the node or edge Ids.
* @param offset An array that contains the offset after expansion.
* @return a expanded Id array.
*/
static IdArray ExpandIds(IdArray ids, IdArray offset);
/*!
* \brief Convert the graph to a simple graph.
* \param graph The input graph.
* \return a new immutable simple graph with no multi-edge.
* @brief Convert the graph to a simple graph.
* @param graph The input graph.
* @return a new immutable simple graph with no multi-edge.
*/
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
* j -> i, the new graph will have max(m, n) edges for both
* i -> j and j -> i.
*
* \param graph The input graph.
* \return a new mutable bidirected graph.
* @param graph The input graph.
* @return a new mutable bidirected 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.
* \param graph The input graph.
* \return a new immutable bidirected
* @param graph The input graph.
* @return a new immutable bidirected
* 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
* than ToBidirectedImmutableGraph. It return a null pointer if the conversion
* fails.
*
* \param graph The input graph.
* \return a new immutable bidirected graph.
* @param graph The input graph.
* @return a new immutable bidirected graph.
*/
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
* `num_hops`.
* \param graph The input graph.
* \param nodes The input nodes that form the core of the induced subgraph.
* \param num_hops The number of hops to reach.
* \return the induced subgraph with HALO nodes.
* @param graph The input graph.
* @param nodes The input nodes that form the core of the induced subgraph.
* @param num_hops The number of hops to reach.
* @return the induced subgraph with HALO nodes.
*/
static HaloSubgraph GetSubgraphWithHalo(
GraphPtr graph, IdArray nodes, int num_hops);
/*!
* \brief Reorder the nodes in the immutable graph.
* \param graph The input graph.
* \param new_order The node Ids in the new graph. The index in `new_order` is
* @brief Reorder the nodes in the immutable graph.
* @param graph The input graph.
* @param new_order The node Ids in the new graph. The index in `new_order` is
* old node Ids.
* \return the graph with reordered node Ids
* @return the graph with reordered node Ids
*/
static GraphPtr ReorderImmutableGraph(
ImmutableGraphPtr ig, IdArray new_order);
......
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/graph_traversal.h
* \brief common graph traversal operations
* @file dgl/graph_traversal.h
* @brief common graph traversal operations
*/
#ifndef DGL_GRAPH_TRAVERSAL_H_
#define DGL_GRAPH_TRAVERSAL_H_
......@@ -13,7 +13,7 @@ namespace dgl {
///////////////////////// 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).
* An optional tag can be specified on each node/edge (represented by an int
......@@ -24,7 +24,7 @@ struct Frontiers {
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
*/
IdArray tags;
......@@ -36,43 +36,43 @@ struct Frontiers {
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 sources Source nodes.
* \return A Frontiers object containing the search result
* @param csr The input csr matrix.
* @param sources Source nodes.
* @return A Frontiers object containing the search result
*/
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.
*
* \param csr The input csr matrix.
* \param sources Source nodes.
* \return A Frontiers object containing the search result
* @param csr The input csr matrix.
* @param sources Source nodes.
* @return A Frontiers object containing the search result
*/
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.
* \return A Frontiers object containing the search result
* @param csr The input csr matrix.
* @return A Frontiers object containing the search result
*/
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 sources Source nodes.
* \return A Frontiers object containing the search result
* @param csr The input csr matrix.
* @param sources Source nodes.
* @return A Frontiers object containing the search result
*/
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.
*
* The traversal visit edges in its DFS order. Edges have three tags:
......@@ -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
* edge is NOT in the DFS tree.
*
* \param csr The input csr matrix.
* \param sources Source nodes.
* \param has_reverse_edge If true, REVERSE edges are included
* \param has_nontree_edge If true, NONTREE edges are included
* \param return_labels If true, return the recorded edge tags.
* \return A Frontiers object containing the search result
* @param csr The input csr matrix.
* @param sources Source nodes.
* @param has_reverse_edge If true, REVERSE edges are included
* @param has_nontree_edge If true, NONTREE edges are included
* @param return_labels If true, return the recorded edge tags.
* @return A Frontiers object containing the search result
*/
Frontiers DGLDFSLabeledEdges(
const CSRMatrix& csr, IdArray source, const bool has_reverse_edge,
......
This diff is collapsed.
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/aten/kernel.h
* \brief Sparse matrix operators.
* @file dgl/aten/kernel.h
* @brief Sparse matrix operators.
*/
#ifndef DGL_KERNEL_H_
#define DGL_KERNEL_H_
......@@ -18,15 +18,15 @@ namespace dgl {
namespace aten {
/*!
* \brief Generalized Sparse Matrix-Matrix Multiplication.
* \param op The binary operator, could be `add`, `sub', `mul`, 'div',
* @brief Generalized Sparse Matrix-Matrix Multiplication.
* @param op The binary operator, could be `add`, `sub', `mul`, 'div',
* `copy_u`, `copy_e'.
* \param op The reduce operator, could be `sum`, `min`, `max'.
* \param graph The graph we apply SpMM on.
* \param ufeat The source node feature.
* \param efeat The edge feature.
* \param out The output feature on destination nodes.
* \param out_aux A list of NDArray's that contains auxiliary information such
* @param op The reduce operator, could be `sum`, `min`, `max'.
* @param graph The graph we apply SpMM on.
* @param ufeat The source node feature.
* @param efeat The edge feature.
* @param out The output feature on destination nodes.
* @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
* `min` and `max`.
*/
......@@ -35,20 +35,20 @@ void SpMM(
NDArray ufeat, NDArray efeat, NDArray out, std::vector<NDArray> out_aux);
/*!
* \brief Generalized Sampled Dense-Dense Matrix Multiplication.
* \param op The binary operator, could be `add`, `sub', `mul`, 'div',
* @brief Generalized Sampled Dense-Dense Matrix Multiplication.
* @param op The binary operator, could be `add`, `sub', `mul`, 'div',
* `dot`, `copy_u`, `copy_e'.
* \param graph The graph we apply SpMM on.
* \param ufeat The source node feature.
* \param vfeat The destination node feature.
* \param out The output feature on edge.
* @param graph The graph we apply SpMM on.
* @param ufeat The source node feature.
* @param vfeat The destination node feature.
* @param out The output feature on edge.
*/
void SDDMM(
const std::string& op, HeteroGraphPtr graph, NDArray ufeat, NDArray efeat,
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
* B_weights are 1D vectors.)
......@@ -57,7 +57,7 @@ std::pair<CSRMatrix, NDArray> CSRMM(
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
* are 1D vectors.)
......
/*!
* Copyright (c) 2019 by Contributors
* \file dgl/lazy.h
* \brief Lazy object that will be materialized only when being queried.
* @file dgl/lazy.h
* @brief Lazy object that will be materialized only when being queried.
*/
#ifndef DGL_LAZY_H_
#define DGL_LAZY_H_
......@@ -11,7 +11,7 @@
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 is currently not threaad safe.
......@@ -23,7 +23,7 @@ class 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)) {}
......@@ -31,10 +31,10 @@ class Lazy {
~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.
* \param fn The creator function.
* \return the object value.
* @param fn The creator function.
* @return the object value.
*/
template <typename Fn>
const T& Get(Fn fn) {
......
/*!
* Copyright (c) 2019 by Contributors
* \file dgl/nodeflow.h
* \brief DGL NodeFlow class.
* @file dgl/nodeflow.h
* @brief DGL NodeFlow class.
*/
#ifndef DGL_NODEFLOW_H_
#define DGL_NODEFLOW_H_
......@@ -18,7 +18,7 @@ namespace dgl {
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.
*
* We store multiple layers of the sampling results in a single graph, which
......@@ -26,22 +26,22 @@ class ImmutableGraph;
* node and edge mapping from the NodeFlow graph to the parent graph.
*/
struct NodeFlowObject : public runtime::Object {
/*! \brief The graph. */
/*! @brief The graph. */
GraphPtr graph;
/*!
* \brief the offsets of each layer.
* @brief the offsets of each layer.
*/
IdArray layer_offsets;
/*!
* \brief the offsets of each flow.
* @brief the offsets of each flow.
*/
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;
/*!
* \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;
......@@ -54,14 +54,14 @@ class NodeFlow : public runtime::ObjectRef {
public:
DGL_DEFINE_OBJECT_REF_METHODS(NodeFlow, runtime::ObjectRef, NodeFlowObject);
/*! \brief create a new nodeflow reference */
/*! @brief create a new nodeflow reference */
static NodeFlow Create() {
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
* correct starting and ending location of a layer.
......@@ -83,14 +83,14 @@ class NodeFlow : public runtime::ObjectRef {
* If fmt == "coo", the function returns two arrays: idx, eid. Here, the idx
* array is the concatenation of src and dst node id arrays.
*
* \param graph An immutable graph.
* \param fmt the format of the returned adjacency matrix.
* \param layer0_size the size of the first layer in the block.
* \param layer1_start the location where the second layer starts.
* \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 graph An immutable graph.
* @param fmt the format of the returned adjacency matrix.
* @param layer0_size the size of the first layer in the block.
* @param layer1_start the location where the second layer starts.
* @param layer1_end the location where the secnd layer ends.
* @param remap Indicates to remap all vertex ids and edge Ids to local Id
* space.
* \return a vector of IdArrays.
* @return a vector of IdArrays.
*/
std::vector<IdArray> GetNodeFlowSlice(
const ImmutableGraph &graph, const std::string &fmt, size_t layer0_size,
......
/*!
* Copyright (c) 2019 by Contributors
* \file packed_func_ext.h
* \brief Extension package to PackedFunc
* @file packed_func_ext.h
* @brief Extension package to PackedFunc
* This enables pass ObjectRef types into/from PackedFunc.
*/
#ifndef DGL_PACKED_FUNC_EXT_H_
......@@ -19,8 +19,8 @@
namespace dgl {
namespace runtime {
/*!
* \brief Runtime type checker for node type.
* \tparam T the type to be checked.
* @brief Runtime type checker for node type.
* @tparam T the type to be checked.
*/
template <typename T>
struct ObjectTypeChecker {
......
/*!
* Copyright (c) 2017 by Contributors
* \file dgl/random.h
* \brief Random number generators
* @file dgl/random.h
* @brief Random number generators
*/
#ifndef DGL_RANDOM_H_
......@@ -36,36 +36,36 @@ inline uint32_t GetThreadId() {
}; // namespace
/*!
* \brief Thread-local Random Number Generator class
* @brief Thread-local Random Number Generator class
*/
class RandomEngine {
public:
/*! \brief Constructor with default seed */
/*! @brief Constructor with default seed */
RandomEngine() {
std::random_device rd;
SetSeed(rd());
}
/*! \brief Constructor with given seed */
/*! @brief Constructor with given 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() {
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()); }
/*!
* \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_()); }
/*!
* \brief Generate a uniform random integer in [0, upper)
* @brief Generate a uniform random integer in [0, upper)
*/
template <typename T>
T RandInt(T upper) {
......@@ -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>
T RandInt(T lower, T upper) {
......@@ -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>
T Uniform() {
......@@ -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>
T Uniform(T lower, T upper) {
......@@ -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.
* \tparam IdxType Return integer type.
* \param prob Array of N unnormalized probability of each element. Must be
* @tparam IdxType Return integer type.
* @param prob Array of N unnormalized probability of each element. Must be
* 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>
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
*
* If replace is false, the number of picked integers must not larger than N.
*
* \tparam IdxType Id type
* \tparam FloatType Probability value type
* \param num Number of integers to choose
* \param prob Array of N unnormalized probability of each element. Must be
* @tparam IdxType Id type
* @tparam FloatType Probability value type
* @param num Number of integers to choose
* @param prob Array of N unnormalized probability of each element. Must be
* non-negative.
* \param out The output buffer to write selected indices.
* \param replace If true, choose with replacement.
* @param out The output buffer to write selected indices.
* @param replace If true, choose with replacement.
*/
template <typename IdxType, typename FloatType>
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
*
* If replace is false, the number of picked integers must not larger than N.
*
* \tparam IdxType Id type
* \tparam FloatType Probability value type
* \param num Number of integers to choose
* \param prob Array of N unnormalized probability of each element. Must be
* @tparam IdxType Id type
* @tparam FloatType Probability value type
* @param num Number of integers to choose
* @param prob Array of N unnormalized probability of each element. Must be
* non-negative.
* \param replace If true, choose with replacement.
* \return Picked indices
* @param replace If true, choose with replacement.
* @return Picked indices
*/
template <typename IdxType, typename FloatType>
IdArray Choice(IdxType num, FloatArray prob, bool replace = true) {
......@@ -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.
*
* \tparam IdxType Return integer type
* \param num Number of integers to choose
* \param population Total number of elements to choose from.
* \param out The output buffer to write selected indices.
* \param replace If true, choose with replacement.
* @tparam IdxType Return integer type
* @param num Number of integers to choose
* @param population Total number of elements to choose from.
* @param out The output buffer to write selected indices.
* @param replace If true, choose with replacement.
*/
template <typename IdxType>
void UniformChoice(
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.
*
* \tparam IdxType Return integer type
* \param num Number of integers to choose
* \param population Total number of elements to choose from.
* \param replace If true, choose with replacement.
* \return Picked indices
* @tparam IdxType Return integer type
* @param num Number of integers to choose
* @param population Total number of elements to choose from.
* @param replace If true, choose with replacement.
* @return Picked indices
*/
template <typename IdxType>
IdArray UniformChoice(IdxType num, IdxType population, bool replace = true) {
......@@ -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.
*
* For example, if split=[0, 4, 10] and bias=[1.5, 1], it means to pick some
......@@ -210,13 +210,13 @@ class RandomEngine {
*
* If replace is false, num must not be larger than population.
*
* \tparam IdxType Return integer type
* \param num Number of integers to choose
* \param split Array of T+1 split positions of different segments(including
* @tparam IdxType Return integer type
* @param num Number of integers to choose
* @param split Array of T+1 split positions of different segments(including
* start and end)
* \param bias Array of T weight of each segments.
* \param out The output buffer to write selected indices.
* \param replace If true, choose with replacement.
* @param bias Array of T weight of each segments.
* @param out The output buffer to write selected indices.
* @param replace If true, choose with replacement.
*/
template <typename IdxType, typename FloatType>
void BiasedChoice(
......@@ -224,16 +224,16 @@ class RandomEngine {
bool replace = true);
/*!
* \brief Pick random integers with different probability for different
* @brief Pick random integers with different probability for different
* segments.
*
* If replace is false, num must not be larger than population.
*
* \tparam IdxType Return integer type
* \param num Number of integers to choose
* \param split Split positions of different segments
* \param bias Weights of different segments
* \param replace If true, choose with replacement.
* @tparam IdxType Return integer type
* @param num Number of integers to choose
* @param split Split positions of different segments
* @param bias Weights of different segments
* @param replace If true, choose with replacement.
*/
template <typename IdxType, typename FloatType>
IdArray BiasedChoice(
......
/*!
* Copyright (c) 2017 by Contributors
* \file dgl/runtime/c_backend_api.h
* \brief DGL runtime backend API.
* @file dgl/runtime/c_backend_api.h
* @brief DGL runtime backend API.
*
* The functions defined in this header are intended to be
* used by compiled dgl operators, usually user do not need to use these
......@@ -18,109 +18,109 @@ extern "C" {
// 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).
* The user do should not call DGLFuncFree on func.
*
* \param mod_node The module handle.
* \param func_name The name of the function.
* \param out The result function.
* \return 0 when no error is thrown, -1 when failure happens
* @param mod_node The module handle.
* @param func_name The name of the function.
* @param out The result function.
* @return 0 when no error is thrown, -1 when failure happens
*/
DGL_DLL int DGLBackendGetFuncFromEnv(
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 ptr The symbol address.
* \return 0 when no error is thrown, -1 when failure happens
* @param name The name of the symbol
* @param ptr The symbol address.
* @return 0 when no error is thrown, -1 when failure happens
*/
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.
*
* \param nbytes The size of the space requested.
* \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 dtype_code_hint The type code of the array elements. Only used in
* @param nbytes The size of the space requested.
* @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 dtype_code_hint The type code of the array elements. Only used in
* 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.
* \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(
int device_type, int device_id, uint64_t nbytes, int dtype_code_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 device_type The device type 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
* @param ptr The result allocated space pointer.
* @param device_type The device type 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
*
* \sa DGLBackendAllocWorkspace
*/
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 {
/*!
* \brief Auxiliary used for synchronization
* @brief Auxiliary used for synchronization
*/
void* sync_handle;
/*! \brief total amount of task */
/*! @brief total amount of task */
int32_t num_task;
} DGLParallelGroupEnv;
/*!
* \brief The callback function to execute a parallel lambda
* \param task_id the task id of the function.
* \param penv The parallel environment backs the execution.
* \param cdata The supporting closure data.
* @brief The callback function to execute a parallel lambda
* @param task_id the task id of the function.
* @param penv The parallel environment backs the execution.
* @param cdata The supporting closure data.
*/
typedef int (*FDGLParallelLambda)(
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 cdata The closure data.
* \param num_task Number of tasks to launch, can be 0, means launch
* @param flambda The parallel function to be launched.
* @param cdata The closure data.
* @param num_task Number of tasks to launch, can be 0, means launch
* 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(
FDGLParallelLambda flambda, void* cdata, int num_task);
/*!
* \brief BSP barrrier between parallel threads
* \param task_id the task id of the function.
* \param penv The parallel environment backs the execution.
* \return 0 when no error is thrown, -1 when failure happens
* @brief BSP barrrier between parallel threads
* @param task_id the task id of the function.
* @param penv The parallel environment backs the execution.
* @return 0 when no error is thrown, -1 when failure happens
*/
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.
* This function is mainly used for test purpose.
*
* \param handle An global address to indicate f
* \param f The function to be ran
* \param cdata The closure data to pass to the function.
* \param nbytes Number of bytes in the closure data.
* \return 0 when no error is thrown, -1 when failure happens
* @param handle An global address to indicate f
* @param f The function to be ran
* @param cdata The closure data to pass to the function.
* @param nbytes Number of bytes in the closure data.
* @return 0 when no error is thrown, -1 when failure happens
*/
DGL_DLL int DGLBackendRunOnce(
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