Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def build(G, T):
  2.     for x in T:
  3.         if not T.has(x):
  4.             continue
  5.         for y in G:
  6.             if T.has(y):
  7.                 continue
  8.             if G[(x, y)] == 'Y':
  9.             T.add((x, y, 'Y'));
  10.             checkResult = CheckLoop(T)
  11.             if(checkResult.hasXEdge):
  12.                 if(xCount < T.xCount):
  13.                     T.remove(checkResult.getXEdge())
  14.                     return
  15.                 else
  16.                     T.remove((x, y, 'Y'))
  17.     return
  18.  
  19. def buildSpanningTree(G, xCount):
  20.     T = MakeSpanningForest(G)
  21.    
  22.     for i in range(0, G.size):
  23.         rebuild(G, T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement