incident_edges_op

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.

epropEdgePropertyMap

Edge property map to be summed.

vpropVertexPropertyMap (optional, default: None)

If provided, the resulting vertex properties will be stored here.

Returns:
vpropVertexPropertyMap

Resulting vertex property.

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)
[476 435 290 227 448 685 325 369 169 675 321 500 506 521 345 119 816 417
 406 246 473 254 378 344 391 693 450 674 432 360 519 495 610 421 588 581
 620 457 340 498 455 527 620 199 650 263 500 416 580 424 349 313 448 219
 384 309 583 236 139 323 500 559 289 563 573 293 722 617 217 625 386 365
 489 395 263 784 477 378 247 639 595 368 484 464 493 563 418 361 516 576
 715 314 528 308 502 425 607 277 552 592]