Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
26714299
Commit
26714299
authored
4 months ago
by
Octave Perrin
Browse files
Options
Downloads
Patches
Plain Diff
bind graph
parent
167aafee
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/aidge/graph/GraphView.hpp
+6
-6
6 additions, 6 deletions
include/aidge/graph/GraphView.hpp
python_binding/graph/pybind_GraphView.cpp
+48
-3
48 additions, 3 deletions
python_binding/graph/pybind_GraphView.cpp
with
54 additions
and
9 deletions
include/aidge/graph/GraphView.hpp
+
6
−
6
View file @
26714299
...
@@ -379,17 +379,17 @@ public:
...
@@ -379,17 +379,17 @@ public:
* Get the ranked list of nodes in the GraphView.
* Get the ranked list of nodes in the GraphView.
* Node ranking if performed the following:
* Node ranking if performed the following:
* - The root node is put in the ranked list first (rank 1);
* - The root node is put in the ranked list first (rank 1);
* - Then, its child
s
(in order of outputs) are added in the ranked list;
* - Then, its child
ren
(in order of outputs) are added in the ranked list;
* - Then, its parents (in order of inputs) are added in the ranked list;
* - Then, its parents (in order of inputs) are added in the ranked list;
* - The child
s
and parents of the next node in the ranked list are then
* - The child
ren
and parents of the next node in the ranked list are then
* added to the list, and so on.
* added to the list, and so on.
* - Any remaining nodes have no path to the root node and are added in
* - Any remaining nodes have no path to the root node and are added in
* arbitrary order. In this case, the ranking is not garanteed to be unique.
* arbitrary order. In this case, the ranking is not g
u
aranteed to be unique.
*
*
* If the ranking cannot be garanteed to be unique, the second item indicates
* If the ranking cannot be g
u
aranteed to be unique, the second item indicates
* the rank from which unicity cannot be garanteed.
* the rank from which unicity cannot be g
u
aranteed.
* @return std::pair<std::vector<NodePtr>, size_t> Pair with the list of ranked
* @return std::pair<std::vector<NodePtr>, size_t> Pair with the list of ranked
* nodes and the size of the ranked sub-list where unicity is garanteed.
* nodes and the size of the ranked sub-list where unicity is g
u
aranteed.
*/
*/
std
::
pair
<
std
::
vector
<
NodePtr
>
,
size_t
>
getRankedNodes
()
const
;
std
::
pair
<
std
::
vector
<
NodePtr
>
,
size_t
>
getRankedNodes
()
const
;
...
...
This diff is collapsed.
Click to expand it.
python_binding/graph/pybind_GraphView.cpp
+
48
−
3
View file @
26714299
...
@@ -141,6 +141,7 @@ void init_GraphView(py::module& m) {
...
@@ -141,6 +141,7 @@ void init_GraphView(py::module& m) {
:return: Whether any replacement has been made.
:return: Whether any replacement has been made.
:rtype: bool
:rtype: bool
)mydelimiter"
)
)mydelimiter"
)
.
def
(
"clone"
,
&
GraphView
::
clone
,
.
def
(
"clone"
,
&
GraphView
::
clone
,
R"mydelimiter(
R"mydelimiter(
Clone the current GraphView using a callback function for the Node cloning, allowing to specify how each
Clone the current GraphView using a callback function for the Node cloning, allowing to specify how each
...
@@ -154,12 +155,15 @@ void init_GraphView(py::module& m) {
...
@@ -154,12 +155,15 @@ void init_GraphView(py::module& m) {
:return: Cloned GraphView
:return: Cloned GraphView
:rtype: GraphView
:rtype: GraphView
)mydelimiter"
)
)mydelimiter"
)
.
def
(
"get_nodes"
,
&
GraphView
::
getNodes
,
.
def
(
"get_nodes"
,
&
GraphView
::
getNodes
,
R"mydelimiter(
R"mydelimiter(
Get the Nodes in the GraphView.
Get the Nodes in the GraphView.
:return: List of the GraphView's Nodes
:return: List of the GraphView's Nodes
:rtype: List[Node]
:rtype: List[Node]
)mydelimiter"
)
)mydelimiter"
)
.
def
(
"get_node"
,
&
GraphView
::
getNode
,
py
::
arg
(
"node_name"
),
.
def
(
"get_node"
,
&
GraphView
::
getNode
,
py
::
arg
(
"node_name"
),
R"mydelimiter(
R"mydelimiter(
Get the Node with the corresponding name if it is in the GraphView.
Get the Node with the corresponding name if it is in the GraphView.
...
@@ -190,11 +194,52 @@ void init_GraphView(py::module& m) {
...
@@ -190,11 +194,52 @@ void init_GraphView(py::module& m) {
// return py::none();
// return py::none();
// }
// }
// })
// })
.
def
(
"get_ranked_nodes"
,
&
GraphView
::
getRankedNodes
)
.
def
(
"get_ranked_nodes"
,
&
GraphView
::
getRankedNodes
,
.
def
(
"get_ranked_nodes_name"
,
&
GraphView
::
getRankedNodesName
,
py
::
arg
(
"format"
),
py
::
arg
(
"mark_non_unicity"
)
=
true
)
R"mydelimiter(
Get the ranked list of nodes in the GraphView.
Node ranking if performed the following:
- The root node is put in the ranked list first (rank 1);
- Then, its children (in order of outputs) are added in the ranked list;
- Then, its parents (in order of inputs) are added in the ranked list;
- The children and parents of the next node in the ranked list are then added to the list, and so on.
- Any remaining nodes have no path to the root node and are added in arbitrary order. In this case, the ranking is not guaranteed to be unique.
If the ranking cannot be guaranteed to be unique, the second item indicates
the rank from which unicity cannot be guaranteed.
:return: Pair with the list of ranked nodes and the size of the ranked sub-list where unicity is guaranteed.
:rtype: (Node, int)
)mydelimiter"
)
.
def
(
"get_ranked_nodes_name"
,
&
GraphView
::
getRankedNodesName
,
py
::
arg
(
"format"
),
py
::
arg
(
"mark_non_unicity"
)
=
true
,
R"mydelimiter(
//TODO
Get the nodes name according to the GraphView nodes ranking.
@param format The formatting string to be used with fmt::format().
@details The usable positional arguments are the following:
{0} node name, {1} node type, {2} rank, {3} type rank
@param markNonUnicity If true, non unique ranking is prefixed with "?"
@return std::map<NodePtr, std::string> A map with the corresponding names
*/
)mydelimiter"
)
.
def
(
"set_dataformat"
,
&
GraphView
::
setDataFormat
,
py
::
arg
(
"dataformat"
))
.
def
(
"set_dataformat"
,
&
GraphView
::
setDataFormat
,
py
::
arg
(
"dataformat"
))
;
;
m
.
def
(
"get_connected_graph_view"
,
&
getConnectedGraphView
);
m
.
def
(
"get_connected_graph_view"
,
&
getConnectedGraphView
,
R"mydelimiter(
Create a GraphView containing all nodes with a path to given Node.
:param node: Initial node to construct the graph.
:type node: Node
:return: GraphView GraphView containing all nodes with a path to node.
:rtype: GraphView
)mydelimiter"
);
}
}
}
// namespace Aidge
}
// namespace Aidge
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment