public static void groupSelectedNodes(final ZyGraph graph){
  final List<NaviNode> nodes=filterSelectedNodes(graph.getSelectedNodes());
  if (!nodes.isEmpty()) {
    groupNodes(graph,nodes);
  }
}

public static void groupSelectedNodes ( final ZyGraph graph ) { final List < NaviNode > nodes = filterSelectedNodes ( graph . getSelectedNodes ( ) ) ; if ( ! nodes . isEmpty ( ) ) { groupNodes ( graph , nodes ) ; } }
creates a group node that contains all selected nodes of a graph .
