List<FamixAssociation> associationsToOtherEntities = getGraphLoader().getSnapshotAnalyzer().queryAssociationsOfEntities(descendants, null, "from");
associationsToOtherEntities.addAll(getGraphLoader().getSnapshotAnalyzer().queryAssociationsOfEntities(descendants, null, "to"));
Set<AbstractFamixEntity> entitiesToRemove = new HashSet<AbstractFamixEntity>(descendants);
for (FamixAssociation association : associationsToOtherEntities) {
Edge edge = getGraphLoader().getGraph().getEdge(association);
if (edge != null) {
AbstractFamixEntity from = association.getFrom();
AbstractFamixEntity to = association.getTo();
if (descendants.contains(from) && getGraphLoader().getGraph().contains(to)) {
entitiesToRemove.remove(from);