void GraphGraphicsView::depthFirstSearch() { clearArrows(); clearWeights(); drawAllEdges(); drawWeights(); bool hasCircle = false; int depthNo = 1; int endNo = 1; QList<int> prev; for (int u = 0; u < nodes.length(); ++u) { nodes[u]->setDepthNo(0); nodes[u]->setEndNo(0); prev.push_back(-1); } for (int u = 0; u < nodes.length(); ++u) { if (nodes[u]->getDepthNo() == 0) { DFS(u,depthNo, endNo, prev, hasCircle); } } if (hasCircle) { QMessageBox::warning(0, "Warning","This graph has a circle."); } else { QMessageBox::information(0, "Done", "Sum of all weights: "); } scene.update(); }
void GraphGraphicsView::drawShortestPath(int from, int to) { clearArrows(); clearWeights(); int next = prevs[to]; while(next != from) { drawPath(nodes[to],nodes[next]); to = next; next = prevs[next]; } drawPath(nodes[to],nodes[next]); }
int MomentumConn::checkpointRead(const char * cpDir, double * timeptr) { HyPerConn::checkpointRead(cpDir, timeptr); if (!plasticityFlag) return PV_SUCCESS; clearWeights(prev_dwDataStart, getNumDataPatches(), nxp, nyp, nfp); char * path = parent->pathInCheckpoint(cpDir, getName(), "_prev_dW.pvp"); PVPatch *** patches_arg = sharedWeights ? NULL : get_wPatches(); double filetime=0.0; int status = PV::readWeights(patches_arg, prev_dwDataStart, numberOfAxonalArborLists(), getNumDataPatches(), nxp, nyp, nfp, path, parent->icCommunicator(), &filetime, pre->getLayerLoc()); if (parent->columnId()==0 && timeptr && *timeptr != filetime) { fprintf(stderr, "Warning: \"%s\" checkpoint has timestamp %g instead of the expected value %g.\n", path, filetime, *timeptr); } free(path); return status; }
void GraphGraphicsView::clear() { clearNodes(); clearArrows(); clearWeights(); }