# vtkAlgorithm : SetInputConnection() vs AddInputConnection() ?

**URL:** https://discourse.vtk.org/t/vtkalgorithm-setinputconnection-vs-addinputconnection/7475
**Category:** Support
**Created:** [December 22, 2021, 11:13pm UTC](https://discourse.vtk.org/t/vtkalgorithm-setinputconnection-vs-addinputconnection/7475 "2021-12-22T23:13:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nicholas\_Yue](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicholas_yue/32/3751_2.png) [@Nicholas\_Yue](https://discourse.vtk.org/u/Nicholas_Yue)
#### Post date: [December 22, 2021, 11:13pm UTC](https://discourse.vtk.org/t/vtkalgorithm-setinputconnection-vs-addinputconnection/7475/1 "2021-12-22T23:13:25Z")

</div>

I am reading the [documentation](https://vtk.org/doc/nightly/html/classvtkAlgorithm.html#aac26b4138f0e8c07e45c74571f2c51a3) about the methods here but can’t wrap my head around when to use which one

If I am simply connecting the outputport of one node to the inputport of another node, do I add or set ?

Cheers

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [December 22, 2021, 11:54pm UTC](https://discourse.vtk.org/t/vtkalgorithm-setinputconnection-vs-addinputconnection/7475/2 "2021-12-22T23:54:27Z")

</div>

Note that you can connect multiple inputs to the same port. Many times you have only one input in which case you use Set, some filters (such as append poly data) have several inputs in which case you’ll use add.

[https://vtk.org/doc/nightly/html/classvtkAlgorithm.html#aac26b4138f0e8c07e45c74571f2c51a3](https://vtk.org/doc/nightly/html/classvtkAlgorithm.html#aac26b4138f0e8c07e45c74571f2c51a3)

describes this.
