Guest User

Untitled

a guest
May 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. g = Graph[{1 -> 2, 2 -> 3, 3 -> 1, 2 -> 4}, VertexShapeFunction -> "Name"]
  2.  
  3. VertexDegree[g]
  4. (* {2, 3, 2, 1} *)
  5.  
  6. VertexDelete[g, _?(VertexDegree[g, #] < 2 &)]
  7.  
  8. Subgraph[g, KCoreComponents[g, 2], VertexShapeFunction -> "Name"]
  9.  
  10. VertexDelete[g, Pick[VertexList[g], VertexDegree[g], d_ /; d < 2]]
Add Comment
Please, Sign In to add comment