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

Dear Bijal, 

The Networkx API may help you too to achieve what you want, if you extract road topologies with SumoLib and then use it as input for building your graph with Networkx API, it may help you a lot since this API provides various functions for Oriented and Non-oriented graphs.

Good luck,
Arslane

Le ven. 1 févr. 2019 à 08:16, Jakob Erdmann <namdre.sumo@xxxxxxxxx> a écrit :
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).

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
_______________________________________________
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