1 %feature("docstring") gum::DiGraph 2 " 3 DiGraph represents a Directed Graph. 4 5 DiGraph() -> DiGraph 6 default constructor 7 8 DiGraph(src) -> DiGraph 9 Parameters: 10 * **src** (*pyAgrum.DiGraph*) -- the digraph to copy 11 " 12 13 %feature("docstring") gum::DiGraph::addArc 14 " 15 Add an arc from tail to head. 16 17 Parameters 18 ---------- 19 tail : int 20 the id of the tail node 21 head : int 22 the id of the head node 23 24 Raises 25 ------ 26 pyAgrum.InvalidNode 27 If head or tail does not belong to the graph nodes. 28 " 29 30 %feature("docstring") gum::DiGraph::addNode 31 " 32 Returns 33 ------- 34 int 35 the new NodeId 36 " 37 38 %feature("docstring") gum::DiGraph::addNodes 39 " 40 Add n nodes. 41 42 Parameters 43 ---------- 44 n : int 45 the number of nodes to add. 46 47 Returns 48 ------- 49 Set of int 50 the new ids 51 " 52 53 %feature("docstring") gum::DiGraph::addNodeWithId 54 " 55 Add a node by choosing a new NodeId. 56 57 Parameters 58 ---------- 59 id : int 60 The id of the new node 61 62 Raises 63 ------ 64 pyAgrum.DuplicateElement 65 If the given id is already used 66 " 67 68 %feature("docstring") gum::DiGraph::arcs 69 " 70 Returns 71 ------- 72 List 73 the list of the arcs 74 " 75 76 %feature("docstring") gum::DiGraph::children 77 " 78 Parameters 79 ---------- 80 id : int 81 the id of the parent 82 83 Returns 84 ------- 85 Set 86 the set of all the children 87 " 88 89 %feature("docstring") gum::DiGraph::clear 90 " 91 Remove all the nodes and arcs from the graph. 92 " 93 94 %feature("docstring") gum::DiGraph::empty 95 " 96 Check if the graph is empty. 97 98 Returns 99 ------- 100 bool 101 True if the graph is empty 102 " 103 104 %feature("docstring") gum::DiGraph::emptyArcs 105 " 106 Check if the graph doesn't contains arcs. 107 108 Returns 109 ------- 110 bool 111 True if the graph doesn't contains arcs 112 " 113 114 %feature("docstring") gum::DiGraph::eraseArc 115 " 116 Erase the arc between n1 and n2. 117 118 Parameters 119 ---------- 120 n1 : int 121 the id of the tail node 122 n2 : int 123 the id of the head node 124 " 125 %feature("docstring") gum::DiGraph::eraseChildren 126 " 127 Erase the arcs heading through the node's children. 128 129 Parameters 130 ---------- 131 n : int 132 the id of the parent node 133 " 134 135 %feature("docstring") gum::DiGraph::eraseNode 136 " 137 Erase the node and all the related arcs. 138 139 Parameters 140 ---------- 141 id : int 142 the id of the node 143 " 144 145 %feature("docstring") gum::DiGraph::eraseParents 146 " 147 Erase the arcs coming to the node. 148 149 Parameters 150 ---------- 151 n : int 152 the id of the child node 153 " 154 155 %feature("docstring") gum::DiGraph::existsArc 156 " 157 Check if an arc exists bewteen n1 and n2. 158 159 Parameters 160 ---------- 161 n1 : int 162 the id of the tail node 163 n2 : int 164 the id of the head node 165 166 Returns 167 ------- 168 bool 169 True if the arc exists 170 " 171 172 %feature("docstring") gum::DiGraph::existsNode 173 " 174 Check if a node with a certain id exists in the graph. 175 176 Parameters 177 ---------- 178 id : int 179 the checked id 180 181 Returns 182 ------- 183 bool 184 True if the node exists 185 " 186 187 %feature("docstring") gum::DiGraph::ids 188 " 189 .. note:: Deprecated in pyAgrum>0.13.0 190 Please use nodes() instead 191 " 192 193 %feature("docstring") gum::DiGraph::nodes 194 " 195 Returns 196 ------- 197 set 198 the set of ids 199 " 200 201 %feature("docstring") gum::DiGraph::parents 202 " 203 Parameters 204 ---------- 205 id : 206 The id of the child node 207 208 Returns 209 ------- 210 Set 211 the set of the parents ids. 212 " 213 214 %feature("docstring") gum::DiGraph::size 215 " 216 Returns 217 ------- 218 int 219 the number of nodes in the graph 220 " 221 222 %feature("docstring") gum::DiGraph::sizeArcs 223 " 224 Returns 225 ------- 226 int 227 the number of arcs in the graph 228 " 229 230 %feature("docstring") gum::DiGraph::toDot 231 " 232 Returns 233 ------- 234 str 235 a friendly display of the graph in DOT format 236 " 237 238 %feature("docstring") gum::DiGraph::topologicalOrder 239 " 240 Returns 241 ------- 242 List 243 the list of the nodes Ids in a topological order 244 245 Raises 246 ------ 247 pyAgrum.InvalidDirectedCycle 248 If this graph contains cycles 249 " 250 251 %feature("docstring") gum::DiGraph::hasDirectedPath 252 " 253 Check if a directedpath exists bewteen from and to. 254 255 Parameters 256 ---------- 257 from : int 258 the id of the first node of the (possible) path 259 to : int 260 the id of the last node of the (possible) path 261 262 Returns 263 ------- 264 bool 265 True if the directed path exists 266 " 267