| 155 | } |
| 156 | |
| 157 | void ALGraph::SetWeight(MyGraphicsLineItem *garc, int weight){ |
| 158 | int strtVex = GetIdOf(garc->stVex()); |
| 159 | int endVex = GetIdOf(garc->edVex()); |
| 160 | ALArc *p = vexList[strtVex].firstArc; |
| 161 | while(p != nullptr){ |
| 162 | if(p->eVexID == endVex){ |
| 163 | p->weight = weight; |
| 164 | p->gArc->setText(QString::asprintf("%d", weight)); |
| 165 | } |
| 166 | p = p->nextArc; |
| 167 | } |
| 168 | if(type == UDG){ |
| 169 | p = vexList[endVex].firstArc; |
| 170 | while(p != nullptr){ |
| 171 | if(p->eVexID == strtVex){ |
| 172 | p->weight = weight; |
| 173 | } |
| 174 | p = p->nextArc; |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | void ALGraph::ConvertType(int _type){ |
| 180 | if(_type == type) return; |