简体   繁体   中英

data structure for Graph in java

i am looking to implement a algorithm for the Travel Salesman Problem. I want to model the solution using the graph , in this a vertex will represent a city and edge will represent the cost from one city to another. At any point i have to compute cost from one city to another like (cityA, cityB)--->cost

What data structure in java should i use for graph?

And what kind of GUI tool or library can i use to represent a graph ?

如果您可以自由使用外部库,则JGraphT易于使用。

Why a graph, of course. Take a look at JUNG .

depending on the size of your problem and your hardware, you might want to take a look at nosql graph databases like: http://neo4j.org/

most of them are easy to handle and some (like neo4j) provide a graph visualization which is nice for debugging purpose.

if you want to develop with as much performance as possible, you might have to create your own simple graph format. Most of the told ones are slow due to a lot of overhead (generics etc.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM