שאלה בגרפים

limp146

New member
שאלה בגרפים

נתון גרף קשיר לא מכוון G=(V,E), פונקצית משקל , וקשת (u,v)E. תארו אלגוריתם ליניארי שבודק האם קיים עץ פורש מינימאלי של G שמכיל את הקשת (u,v).
 

johnny d

New member
תשובה

find MST: T, if e is not in it add to T, now you will have a cycle C, if C contain an edge which is not e but weights the same then the answer is YES, otherwise the answer is NO.
 
למעלה