I need to write some function using ML, this function receives the list of the edges of the directed graph [(1,2),(1,3),(3,2)], it means directed edge from 1 to 2 and from 1 to 3…, and I receive also two vertices, I need to find all possible ways from first vertex to second and list of the possible paths, for example for vertices 1, 2, I need to display the list [[1,2],[1,3,2]], how can I do it ML if can’t store data about the vertices, thanks in advance for any idea.
Share
If you want to store data about the vertices, you need a finite map from verticies to data.
The map might offer a signature like this:
To implement this signature, you could consider a simple list of
vertex * 'apairs, or something more ambitious like a balanced binary search tree.