Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- g = Graph[{1 -> 2, 2 -> 3, 3 -> 1, 2 -> 4}, VertexShapeFunction -> "Name"]
- VertexDegree[g]
- (* {2, 3, 2, 1} *)
- VertexDelete[g, _?(VertexDegree[g, #] < 2 &)]
- Subgraph[g, KCoreComponents[g, 2], VertexShapeFunction -> "Name"]
- VertexDelete[g, Pick[VertexList[g], VertexDegree[g], d_ /; d < 2]]
Add Comment
Please, Sign In to add comment