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) [605 241 559 412 398 361 623 469 522 566 459 455 329 615 451 459 390 367 357 615 556 257 424 543 352 782 633 588 286 467 352 368 217 403 243 613 137 561 236 592 528 654 646 563 697 413 417 384 332 419 106 427 299 397 395 467 556 136 585 824 524 466 489 383 320 489 596 289 448 446 531 332 385 385 556 174 198 427 450 586 684 477 562 482 451 265 171 451 510 525 504 407 340 640 305 659 669 396 430 340]