From 35daaed6813a98e230669da0f23ef3321182c4c4 Mon Sep 17 00:00:00 2001 From: thibault allenet <thibault.allenet@cea.fr> Date: Fri, 4 Aug 2023 12:25:41 +0000 Subject: [PATCH] Update pybind comments for graph matching --- .../graphmatching/pybind_GRegex.cpp | 19 +++++++++---------- python_binding/graphmatching/pybind_Match.cpp | 9 ++++++--- .../graphmatching/pybind_NodeRegex.cpp | 8 +++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/python_binding/graphmatching/pybind_GRegex.cpp b/python_binding/graphmatching/pybind_GRegex.cpp index bda8f72f3..48d0e19ff 100644 --- a/python_binding/graphmatching/pybind_GRegex.cpp +++ b/python_binding/graphmatching/pybind_GRegex.cpp @@ -20,22 +20,21 @@ void init_GRegex(py::module& m){ py::class_<GRegex, std::shared_ptr<GRegex>>(m, "GRegex", "GRegex class combines a Node Regex and a list of Graph Regex that together describes a graph pattern as a graph regular expression. GRegex find patterns in a given graph that matches the graph regular expression.") .def(py::init<const std::map<std::string,NodeRegex*>&, std::vector<std::string>&>(), py::arg("nodesRegex"), py::arg("seqRegexps"), R"mydelimiter( Constructor of GRegex - - Parameters - ---------- - :param nodesRegex: Describe the conditions an operator has to fulfill. Dictionnary mapping a string (keys) to :py:class:`aidge_core.NodeRegex` (values). - :type nodesRegex: :py:class: `Dict` + + :param nodesRegex: Describe the conditions an operator has to fulfill. + :type nodesRegex: Dict[str,:py:class:`aidge_core.NodeRegex`] :param seqRegexps: Describe the graph topological pattern. List of Graph Regex as strings. - :type seqRegexps: :py:class: `list` + :type seqRegexps: List[str] )mydelimiter") .def("match", &GRegex::match, py::arg("graphToMatch"), R"mydelimiter( - Launch the graph matching algorithm on a given graph. Returns the matched graph patterns in a :py:class: `aidge_core.Match`. + Launch the graph matching algorithm on a given graph. - Parameters - ---------- :param graphToMatch: The graph to perform the matching algorithm on. - :type graphToMatch: :py:class: `aidge_core.GraphView` + :type graphToMatch: :py:class:`aidge_core.GraphView` + + :returns: Matched graph patterns. + :rtype: :py:class:`aidge_core.Match` )mydelimiter") ; diff --git a/python_binding/graphmatching/pybind_Match.cpp b/python_binding/graphmatching/pybind_Match.cpp index 600d39208..a2d2654f4 100644 --- a/python_binding/graphmatching/pybind_Match.cpp +++ b/python_binding/graphmatching/pybind_Match.cpp @@ -19,13 +19,16 @@ void init_Match(py::module& m){ py::class_<Match, std::shared_ptr<Match>>(m, "Match", "Match class stores the matched patterns resulting from a graph matching query. A matched pattern is the combinaison of the graph pattern start nodes and the set of all the nodes in the matched pattern (including the start nodes)") .def(py::init<>()) .def("get_nb_match", &Match::getNbMatch, R"mydelimiter( - The number of graph patterns matched + :returns: The number of graph patterns matched + :rtype: int )mydelimiter") .def("get_start_nodes", &Match::getStartNodes, R"mydelimiter( - All matched graph patterns start nodes + :returns: All matched graph patterns start nodes + :rtype: List[List[:py:class:`aidge_core.Nodes`]] )mydelimiter") .def("get_match_nodes", &Match::getMatchNodes, R"mydelimiter( - All matched graph patterns sets of matched nodes + :returns: All matched graph patterns sets of matched nodes + :rtype: List[Set[:py:class:`aidge_core.Nodes`]] )mydelimiter"); } } diff --git a/python_binding/graphmatching/pybind_NodeRegex.cpp b/python_binding/graphmatching/pybind_NodeRegex.cpp index 6bbb74764..034987f9c 100644 --- a/python_binding/graphmatching/pybind_NodeRegex.cpp +++ b/python_binding/graphmatching/pybind_NodeRegex.cpp @@ -15,14 +15,12 @@ namespace py = pybind11; namespace Aidge { void init_NodeRegex(py::module& m){ - py::class_<NodeRegex, std::shared_ptr<NodeRegex>>(m, "NodeRegex", "NodeRegex class describes a condition to test on any operator. Current version only tests the type of the operator.") + py::class_<NodeRegex, std::shared_ptr<NodeRegex>>(m, "NodeRegex", "NodeRegex class describes a condition to test on any operator. Current version only supports testing the type of the operator.") .def(py::init<const std::string>(), py::arg("condition"), R"mydelimiter( Constructor of NodeRegex - Parameters - ---------- - :param condition: Condition to be fulfilled by an operator. Currently supported conditions are only the operator types. - :type condition: `string` + :param condition: Condition to be fulfilled by an operator. + :type condition: str )mydelimiter") ; -- GitLab