void network::edgesBetween(list< edgeDescriptor > &res, nodeDescriptor sourceNode, nodeKind targetNodeKind) { node::edgeDescriptor ea,ee; ea = 0; ee = node::theNodes[sourceNode]->degree(); for (; ea != ee; ea++) if (match (node::theNodes[sourceNode]->getTarget(ea), targetNodeKind)) if (isInsideNetwork( node::theNodes[sourceNode]->getTarget(ea) )) res.push_back (make_pair(sourceNode,ea)); }
unsigned int network::randomNode(nodeKind nodeKind) { int res; do // Vorsicht Endlosschleife { res = noise.getUniformInt( 0, node::theNodes.size() -1); } while (node::theNodes[res] == NULL || ( !(nodeKind & node::theNodes[res]->getNodeInfo().theNodeKind)) || (!isInsideNetwork(res)) ); return res; }
void network::edgesMatching (edgeList &res, networkElementType edgeType) { node::edgeDescriptor ea,ee; nodeIterator vi; for (vi = theNodes.begin(); vi != theNodes.end(); vi++) { ea = 0; ee = node::theNodes[*vi]->degree(); for (; ea != ee; ea++) if (((edgeVirtual*)node::theNodes[*vi]->getEdge(ea) )->getEdgeInfo().theEdgeType == edgeType) if (isInsideNetwork((node::theNodes[*vi])->getTarget(ea))) res.push_back (make_pair(*vi,ea)); } }
void statisticsNetwork::saveAdjacencyList(string fileName) { ofstream out(fileName.c_str()); network::nodeIterator it; network::nodeList vl; verticesMatching(vl, _dynNode_); out << vl.size() << "\n"; for( it = vl.begin(); it != vl.end(); it++) for( node::edgeDescriptor l=0; l<node::theNodes[*it]->degree() ;l++) if (isInsideNetwork(getTarget (*it, l) )) out << *it <<' '<< node::theNodes[*it]->getTarget(l)->getNumber() <<' '<< node::theNodes[*it]->getWeight(l) <<"\n"; // VERÄNDERT // // node::edgeDescriptor ea, ee; // for ( it = theNodes.begin() ; it != theNodes.end() ; it++) // { // // ea = 0; // ee = node::theNodes[*it] ->degree(); // // // for (; ea != ee; ea++) //// { // // Ausgabe der Nodenummer: // out << *it << " "; // // //Ausgabe der jeweiligen Edge // node::theNodes[*it]->printEdgeStatistics(out, network::edgeVerbosity()); // out << endl; // // ENDE //// out << endl; // // /* VERALTET // out << i << " " <<(*ea)->target->getNumber() << " "; // if ((*ea)->getEdgeInfo().theEdgeKind & _weighted_) // out << ((weightedEdge*)(*ea))->getWeight() << "\n"; // else // out << "\n"; // */ //// } // } out.close(); }