graph_tool.incident_edges_op#
- graph_tool.incident_edges_op(g, direction, op, eprop, vprop=None)[source]#
Return a vertex property map corresponding to a specific operation (sum, product, min or max) on the edge property eprop of incident edges on each vertex, following the direction given by direction.
- Parameters:
- direction“in” or “out”
Direction of the incident edges.
- op“sum”, “prod”, “min” or “max”
Operation performed on incident edges.
- eprop
EdgePropertyMap
Edge property map to be summed.
- vprop
VertexPropertyMap
(optional, default: None) If provided, the resulting vertex properties will be stored here.
- Returns:
- vprop
VertexPropertyMap
Resulting vertex property.
- vprop
Examples
>>> gt.seed_rng(42) >>> g = gt.random_graph(100, lambda: (3, 3)) >>> vsum = gt.incident_edges_op(g, "out", "sum", g.edge_index) >>> print(vsum.a) [640 394 373 450 671 141 420 523 447 726 475 510 672 344 320 498 570 489 563 136 442 336 167 483 259 565 684 699 425 635 426 611 454 253 563 554 414 268 346 751 412 276 836 340 684 341 601 490 453 405 518 348 195 555 596 332 253 248 444 507 314 567 357 181 260 290 478 478 713 584 509 354 802 543 408 588 414 694 583 179 321 393 354 338 363 225 574 562 460 679 494 315 234 417 359 254 548 366 229 538]