Pathfinding through pairs of connections

Okay this is a bit of a complicated problem.
I have a List called pipeData. The list contains sets of two ints, call these ints points. The two points form a connection, e.g. (1,3) (4,2) (2,3) (4,3). Now, what I need is to find a way to check if, say, point 4 is connected to point 1. The function then needs to search through the (4,3), then (1,3) and return true. If no connection is found then return false. The number of connections will be somewhere between 10-40, but is theoretically uncapped because the user creates these points in an editor. The number of connections between the points is also uncapped, and the function will run on button press, not on update.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;

public class EditorChassis : MonoBehaviour {

	List<int[]> pipeData = new List<int[]>();

	void Start() {
		//Create a random connection list to test against
		string debug = "Connections created:";
		for(int i = 0;i<20;i++) {
			int pointA = Random.Range(0,20);
			int pointB = Random.Range(0,20);
			temp_pipeData.Add = new int[] {pointA,pointB}
			debug += " ("+pointA+","+pointB+")";
		}
		print(debug);
		print(Connected(0,20));
	}

	bool Connected(int start,int end) {
		//return true if connected, false if not
	}
}

You could create a Node class or stucture where you store the info you want.

public class Node{
    private Vector2 position;
    public Vector2 Position{get{return position;}}
    public List<Node> connections = new List<Node>();
    
    public Node(Vector2 position){
        this.position = position;
    }
    // You don't need the method, it is just to show which it is
    public bool Contains(Node node){
         return connection.Contains(node);
    }
}

Note that the members should maybe be private.

This is exactly what I was looking for, I’ll throw it on here for future reference. Thank you for your help

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
 
public class EditorChassis : MonoBehaviour {
 
    List<int[]> pipeData = new List<int[]>();
    List<int> visited = new List<int>();

    void Start() {
       //Create a random connection list to test against
       string debug = "Connections created:";
       for(int i = 0;i<20;i++) {
         int pointA = Random.Range(0,20);
         int pointB = Random.Range(0,20);
         temp_pipeData.Add = new int[] {pointA,pointB}
         debug += " ("+pointA+","+pointB+")";
       }
       print(debug);
       print(Connected(0,20));
    }
 
    bool Connected(int start,int end) {
       visited.Clear();
       return Connection(start,end);
    }

    bool Connection(int pointA,int pointB){
        if (pointA == pointB) return true;
        for(int i = 0;i<pipeData.Count;i++) {
            if (!visited.Contains(i)) {
                if (pipeData*[0] == pointA) {*

visited.Add(i);
if (Connection(pipeData*[1],pointB) == true) return true;*
}
else if (pipeData*[1] == pointA) {*
visited.Add(i);
if (Connection(pipeData*[0],pointB) == true) return true;*
}
}
}
return false;
}
}