/** Author: David Auber Email : auber@labri.fr Last modification : 20/08/2001 This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #include #include "InducedSubGraphSelection.h" #include #include SELECTIONPLUGIN(InducedSubGraphSelection,"Induced sub-graph","David Auber","08/08/2001","Alpha","0","1"); InducedSubGraphSelection::InducedSubGraphSelection(PropertyContext *context):Selection(context) { addParameter("selectedNodes"); } InducedSubGraphSelection::~InducedSubGraphSelection() {} bool InducedSubGraphSelection::run() { selectionProxy->setAllNodeValue(false); SelectionProxy *entrySelection=0; if (dataSet!=0) dataSet->get("selectedNodes",entrySelection); if (entrySelection==0) entrySelection=getProxy(superGraph,"viewSelection"); Iterator *itN=superGraph->getNodes(); for (;itN->hasNext();) { node itn=itN->next(); selectionProxy->setNodeValue(itn,entrySelection->getNodeValue(itn)); }delete itN; Iterator *itE=superGraph->getEdges(); for (;itE->hasNext();) { edge ite=itE->next(); if (entrySelection->getNodeValue(superGraph->source(ite)) && entrySelection->getNodeValue(superGraph->target(ite))) selectionProxy->setEdgeValue(ite,true); }delete itE; return true; }