'Converting a graph to a matrix - prolog

hi i'm fairly new to prolog and i've been doing some exercices but i need help with a problem.

How can i convert a graph into a matrix ? the program would take a graph and convert it to a matrix. Graph would be a list of edges in this form: graph(g,[arc(a,b), arc(a,c). A matrix would be a list of lists in this form: [[][][]].

thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source