Algorithm to construct wait-for-graph is as follows:
1. For every transaction Ti active at the time of deadlock detection, make a node labeled Ti in the wait-for-graph.
2. For every case, if there is a transaction Ti, waiting for a data-item that is at present allocated and held by transaction Tj, then there is a directed arc from the node for transaction Ti, to the node for transaction Tj.
This answer is imcomplete if you want to read more about this answer than go thorugh this link:-
Attention: NOTHING on this site may be reproduced in any fashion whatsoever without explicit consent (in writing) of the owner of said material, unless otherwise stated on the page where the content originated. Search engines are free to index and cache our content. Users who post their account names or personal information in their questions have no expectation of privacy beyond that point for anything they disclose. Questions are otherwise considered anonymous to the general public.