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 Sir,

I have converted Graph to Adjacency Matrix. But it gives wrong intersection values.

My problem is i am not able to understand why the value of edge.getToNode().getID() shows u'5' (variable type shows Unicode) in place of Value 5? [Please find photo attached here with]

I need integer values because i am doing following :

  def add_edge(self, u, v, weight=1):
        if u in self.vertices and v in self.vertices:
            self.edges[self.edge_indices[u]][self.edge_indices[v]] = weight
            self.edges[self.edge_indices[v]][self.edge_indices[u]] = weight
            return True
        else:
            return False
Please help me to solve this issue.
image.png


--
:)
Bijal Varia

Back to the top