You can use QGIS expressions and check for each point which other points are on the same line. For this to work, you have first to make sure that each network line connects only two points: see the screenshot where each separate line has another color and below for how to achieve that.
The label (2nd line) is based on the expression below and automatically generates the name of the neighboring points:

To prepare this, proceed as follows:
Create a new (empty) multipart line layer, copy and paste all lines from the network there.
Select and merge all features so that the whole network consists of one single multipart feature.
Split the lines with the points. See here how to do so.
Now you're ready to use the expression on the point layer (replace network in line 13 with the name of the layer created in step 3; and replace name at the end of line 19 and the 4th last line with the name of the attribute field that contains the name of the point):
array_to_string (
array_distinct(
array_filter (
string_to_array(
array_to_string (
array_foreach (
generate_series (1, num_geometries(collect($geometry))),
with_variable(
'iteration',
@element,
array_to_string (
array_foreach(
overlay_intersects ('Split',$geometry), -- change layer name here
if (
intersects (
buffer (@element,0.1),
geometry(get_feature_by_id(@layer,@iteration))
),
attribute (get_feature_by_id (@layer,@iteration),'name'), -- change fieldname here
'delete'
)
)
)
)
)
)
),
@element <>'delete' and @element <> name -- change fieldname here
)
)
)
AandBthere is always just one single line, not several separate lines? – Babel Jun 15 '23 at 09:14AandBthere is another pointXon the same line asAandB, thenAandBare still considered to be connected or both of them will only be connected toX? – Babel Jun 15 '23 at 09:32