Question: A friend relationship is a binary relation defined for two persons denoted f ( p 1, p 2), where p 1 and p 2 are

A friend relationship is a binary relation defined for two persons denotedf(p1,p2), wherep1 andp2 are two persons. The meaning is thatp1 is a friend ofp2. Properties of the friend relationship are:

  • ?Iff(p1,p2), thenf(p2,p1): Ifp1 is a friend ofp2, thenp2 is a friend ofp1.
  • ?Iff(p1,p2) andf(p2,p3), thenf(p1,p3): Ifp1 is a friend ofp2 andp2 is a friend ofp3,
  • thenp1 is a friend ofp3.
  • You must write the program namedfriendRelationship.javathat implements the following requirements.

?Your program must read friend relationships among people from an input file namedfriends_input.txt. The format of an input file is shown below:

John, Isobel

Nathan, John

Rebecka, Yorst

Maria, Yorst

Doloris, Maria

Yorst, Doloris

Your program must store the friend relationships in a (simplified) adjacency matrix, which is a two-dimensional matrix. For example, given the above friend relationships, the corresponding adjacency matrix should be:

A friend relationship is a binary relation defined for two persons denotedf(p1,p2),

\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!