code_junkie

finding all vertices in a graph with degree smaller than their neighbors

Nov 12th, 2011
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. let Q = all nodes which haven't been checked (initialize all V)
  2. let Q* = all nodes which satisfy the required condition (initialize to empty)
  3. start with an arbitrary node, v in Q
  4. while Q is not empty
  5. let minDeg be the minimum degree of all v's neighbors
  6. if degree(v) < minDeg
  7. add v to Q*
  8. remove all neighbors of v from Q
  9. remove v from Q
  10. set v = new arbitrary node, v in Q
  11. else
  12. remove v from Q
  13. set v = v's neighbor in Q of minimum degree
Add Comment
Please, Sign In to add comment