chap graphs /store edge weight public void setedge(int iint jint weightassert weight ! "may not set weight to "edge curredge new edge(jweight)if (isedge(ij)/edge already exists in graph vertex[iremove()vertex[iinsert(curredge)else /keep neighbors sorted by vertex index numedge++for (vertex[imovetostart()vertex[icurrpos(vertex[ilength()vertex[inext()if (vertex[igetvalue(vertex(jbreakvertex[iinsert(curredge)public void deledge(int iint /delete edge if (isedge(ij)vertex[iremove()numedge--public boolean isedge(int vint /is ( ,jan edgeedge it vertex[vgetvalue()if ((it !null&(it vertex(= )return truefor (vertex[vmovetostart()vertex[vcurrpos(vertex[vlength()vertex[vnext()/check whole list if (vertex[vgetvalue(vertex(=wreturn truereturn falsepublic int weight(int iint /return weight of edge if (isedge(ij)return vertex[igetvalue(weight()return /set and get marks public void setmark(int vint valmark[vvalpublic int getmark(int vreturn mark[ ]figure (continued