Re: [jgrapht-users] Edge weights
Brought to you by:
barak_naveh,
perfecthash
From: Rushang K. <rus...@ho...> - 2015-07-01 23:13:38
|
I am at work right now and do not remember if such a function exists (not worked on weighted graphs a lot). I guess there should be such a function since your problem is quite intuitive. However, If no such function exists then you could overload the addEdge() to specify a weight for the WeightedGraph. The function would be DefaultWeightedEdge <V, E> addEdge(V v1, V v2, E weight) { DefaultWeightedEdge e1 = super.addEdge(v1, v2); this.setEdgeWeight(e1, weight) If(error) return null else return the edge. } I am sorry if my reply is brief but I am a bit busy right now. If you need more detailed instructions feel free to reply. -----Original Message----- From: fee...@gm... [mailto:fee...@gm...] Sent: Wednesday, July 01, 2015 4:05 PM To: jgr...@li... Subject: [jgrapht-users] Edge weights Hi there, I’m a newbie using Jgrapht… .My problem has to do with a large weighted graph (about 2000 edges) and the assignation of its weights. All I wanna ask is whether or not weights for a graph can be assigned dynamically (a loop) rather than static (one by on)...like: DefaultWeightedEdge e1 = graph.addEdge("vertex1", "vertex2”); graph.setEdgeWeight(e1, 5); (I’d have to write this thousand times…. ) Thanks. Phil ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ jgrapht-users mailing list jgr...@li... https://lists.sourceforge.net/lists/listinfo/jgrapht-users |