programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Paul Clapham
• Ron McLeod
• Bear Bibeault
• Liutauras Vilda
Sheriffs:
• Jeanne Boyarsky
• Junilu Lacar
• Henry Wong
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Jj Roberts
• Tim Holloway
• Piet Souris
Bartenders:
• Himai Minh
• Carey Brown
• salvin francis

How to use the updateVertex and updateEdge methods?

Greenhorn
Posts: 8
Hello All,

I have created an application that deals with creating methods to insert vertices, edges, fetch vertices, edges, delete vertices, edges, but I am having trouble with understanding how to implement the updatevertex and updateEdge methods. Here is what I do have so far. Please do comment what you think I can improve about my application. Thanks!

>

Ranch Hand
Posts: 261
15
Hi, nice work going toward graph theory!

So, you've created a 2D space and given it sparse vertexes and edges running through it.  But I cannot tell what you might do with this "model".  Delete-vertex seems to do nothing but report whether the vertex previously existed.  Is that the idea?

Saloon Keeper
Posts: 4141
160
Also, what are the two methods supposed to do?

A slightly simpler way is to use a Set<Integer> for the vertices and a Set<Point>, the presence of a Point(x, y) meaning an edge between X and Y. If you extend the equals method of a Point so that Point(x, y) equals Point(y, x) you need half the size of Set<Point>in case of an undirected graph.