Adjacency Matrix in prolog -


I need to create a matrix with the article, with the linear headings as shown in the facts: for example

  Article (a, b). Graph (c, c). Graph (b, c).   

I have to output the matrix:

  0 0 0 0 1 0 0 1   

I know That I should make a list for each line, but the problems arise when they are not symbols, numbers, so I have no idea how to know the size of that list (for example if there is an article ( E, F). The list should be six digits so that f can fit). I do not want the full answer, if you do what I have to do, then I think I am fine. "Itemprop =" text ">

I have not written more code recently, but I almost think I will write (not tested):

  printedge (X , Y): - Graph (x, y), write ("1"). Printed (x, y): - \ + graph (x, y), write ("0"). Printmatics: - list = [A , B, C, D], Member (Y, List), NL, Member (X, List), Printed (X, Y), Failed.   

Need to get a list of .

Comments