We describe and apply a simple prescription for defining connected structures in galaxy redshift surveys. The method is based upon two passes with a friends-of-friends group finder. The first pass uses a cylindrical linking volume to find galaxy groups and clusters in order to suppress the line-of-sight smearing introduced by the large random velocities of galaxies within these deep potential wells. The second pass, performed with a spherical linking volume, identifies the connected components. This algorithm has been applied to the Two-degree Field Galaxy Redshift Survey (2dFGRS), within which it picks out a total of 7603 systems containing at least two galaxies and having a mean redshift less than 0.12. Connected systems with many members appear filamentary in nature, and the algorithm recovers two particularly large filaments within the 2dFGRS. For comparison, the algorithm has also been applied to Λ cold dark matter (ΛCDM) mock galaxy surveys. While the model population of such systems is broadly similar to that in the 2dFGRS, it does not generally contain such extremely large structures.