Graph stored as a list of tuples. The first element of tuple - vertex, the second element tuple - vertices with which it is connected.
headName-vertex which I want to connect[:t=Srting]**
elements-vertises which I want to connect[:t=List]**
A can connect vertices so [(1,[2]),(2,[])], but i want connect so [(1,[2]),(2,[1])]. Kind of did, but does not work. What is wrong? Help, please.
connect_command graph headName []=(graph,"You didnt enter elements to connect!\n")
connect_command graph headName elements=
if (has_element graph headName) then ((update_connect graph graph headName elements []),"Element "++headName++" connected with "++listToString (checked_elements graph headName elements []) []++"\n")
else (graph,"Element with "++headName++" name not found!")
update_connect _ [] _ _ result=result
update_connect mainGraph (item:graph) headName (i:elements) result=
if ((fst item)==headName) then (update_connect mainGraph graph headName elements (result++[((fst item),(checked_elements mainGraph headName elements []))]))
else if ((fst item)==i) then (update_connect mainGraph graph headName (i:elements) (result++[((fst item),[headName])]))
else (update_connect mainGraph graph headName elements (result++[item]))
checked_elements _ _ [] result=result
checked_elements graph headName (item:elements) result=
if (has_element graph item)&& (item /=headName)then checked_elements graph headName elements (result++[item])
else (checked_elements graph headName elements result)
headName-vertex which I want to connect*[:t=Srting]*
elements-vertises which I want to connect*[:t=List]*