This week's book giveaways are in the AI and JavaScript forums.We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
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
• Bear Bibeault
• Paul Clapham
• Jeanne Boyarsky
• Knute Snortum
Sheriffs:
• Liutauras Vilda
• Tim Cooke
• Junilu Lacar
Saloon Keepers:
• Ron McLeod
• Stephan van Hulst
• Tim Moores
• Tim Holloway
• Carey Brown
Bartenders:
• Joe Ess
• salvin francis
• fred rosenberger

# 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: 259
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?

Bartender
Posts: 3674
151
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.

 Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads. Java file APIs (DOC, XLS, PDF, and many more) https://products.aspose.com/total/java