Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Convert sumolib.net.readnet Graph to Adjacency Matrix

The edge/node graph can be traversed from a sumolib.net object by calling

net.getNodes()
net.getEdges()
node.getIncoming()
node.getOutgoing()
edge.getFromNode()
edge.getToNode()

If this information is insufficient, please seek advice from a programmer near you (no particular SUMO knowledge is required).
Please note, that I cannot provide general programming advice (http://sumo.dlr.de/wiki/FAQ#I_want_to_do_a_project_with_SUMO_can_you_help_me_with_the_implementation.3F).

regards,
Jakob

Am Fr., 1. Feb. 2019 um 06:58 Uhr schrieb Bijal <bijal.varia88@xxxxxxxxx>:
Dear Jakob,

Please refer my questions and help me to solve the query. I am new to this and stuck at this place.

For you information, I am having GITHub code attached here with. Which is for finding shortes path in graph using Antcolony. 

So my need is to convert sumolib.net.readnet to the required graph input.

Please help me to achieve this.

On Mon, Jan 28, 2019 at 12:54 PM Bijal <bijal.varia88@xxxxxxxxx> wrote:
Dear users,

I got a Graph using sumolib.net.readnet. 

But my problem is to get graph in the form of matrix like following :

graph = [[-1, 5, 7, 9, 2],
[5, -1, 12, 8, 6],
[7, 12, -1, 13, 21],
[9, 8, 13, -1, 9],
[2, 6, 21, 9, -1]]
Would you please help me with some code or something so that i can get this kind of graph?

Thanks in advance. Regards.
:)
Bijal Varia


--
:)
Bijal Varia
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top