Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // itero sulla lista per costruire i nodi
- for (std::list<Mem>::iterator it = goodMemList.begin(),
- end = goodMemList.end(); it != end; ++it) {
- Node IntronMem;
- IntronMem = IntronGraph.addNode();
- it->setIntronNode(IntronMem);
- IntronNodesMap[IntronMem] = *it;
- }
- // per ora archi con peso 0 tra ogni nodo e il suo consecutivo
- for (lemon::ListDigraph::NodeIt u(IntronGraph); u != lemon::INVALID; ++u){
- for (lemon::ListDigraph::NodeIt v(IntronGraph); v != lemon::INVALID; ++v){
- if (u < v) {
- Arc arc = IntronGraph.addArc(u, v);
- IntronEdgesMap[arc] = 0;
- }
- }
- }
- // stampo numero di nodi, numero di archi e "stampo" il grafo
- int numberN = 0;
- for (lemon::ListDigraph::NodeIt n(IntronGraph); n != lemon::INVALID; ++n){
- numberN++;
- }
- if(numberN > 1 ){
- std::cout << "Number of nodes: " << numberN << std::endl;
- int numberA = 0;
- for (lemon::ListDigraph::ArcIt arc(IntronGraph); arc != lemon::INVALID; ++arc){
- numberA++;
- }
- std::cout << "Number of arcs: " << numberA << std::endl;
- for (lemon::ListDigraph::ArcIt arc(IntronGraph); arc != lemon::INVALID; ++arc){
- auto idNodeS = IntronGraph.id(IntronGraph.source(arc));
- auto idNodeT = IntronGraph.id(IntronGraph.target(arc));
- auto idArc = IntronGraph.id(arc);
- std::cout << "Arc " << idArc << " goes from node "
- << IntronGraph.id(IntronGraph.source(arc)) << " ("
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeS)].t
- << " "
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeS)].p
- << " "
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeS)].l
- << ") to node "
- << IntronGraph.id(IntronGraph.target(arc)) << " ("
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeT)].t
- << " "
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeT)].p
- << " "
- << IntronNodesMap[IntronGraph.nodeFromId(idNodeT)].l
- << "), weight = " << IntronEdgesMap[arc] << std::endl;
- }
- }else if (numberN == 1){
- std::cout << "one node: " << IntronNodesMap[IntronGraph.nodeFromId(0)].t
- << " " << IntronNodesMap[IntronGraph.nodeFromId(0)].p << " "
- << IntronNodesMap[IntronGraph.nodeFromId(0)].l << " "
- << std::endl;
- }else{
- std::cout << "no node\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement