Thanks for reply harald sir.

Is there any way to convert all the edges to bidirectional? Or any other
solution,if you may suggest?

I have modify the code as following :

> def get_EdgeId_From_vertex(prenode,nextnode):

    # Retrive Edge Id from Graph by giving Previous Node and Next Node

    for x in graph.getNodes():

        if(str(int(x.getID()) - 1) == str(prenode)):

            #print 'Out Going Edge of :' + str(x.getID()) + ' Are ' +
> str(x.getOutgoing())

            for edge in x.getOutgoing():

                #check if Next node of this edge is nextnode??

                if(int(str(edge.getToNode().getID()))-1 == nextnode):

                    return str(edge.getID())


>             for edge in x.getIncoming():

                #check if Next node of this edge is nextnode??

                if(int(str(edge.getFromNode().getID()))-1 == nextnode):

                    return str(edge.getID())


> But this gives error :
*traci.exceptions.TraCIException: Vehicle 'vehicle0' has no valid route. No
connection between edge '8' and edge '11'.*



On Wed, Apr 3, 2019 at 5:04 PM <[email protected]> wrote:

> Send sumo-user mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://www.eclipse.org/mailman/listinfo/sumo-user
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of sumo-user digest..."
>
>
> Today's Topics:
>
>    1. Re: Convert sumolib.net.readnet Graph to Adjacency Matrix
>       (Bijal) (Harald Schaefer)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 3 Apr 2019 11:04:38 +0200
> From: Harald Schaefer <[email protected]>
> To: [email protected]
> Subject: Re: [sumo-user] Convert sumolib.net.readnet Graph to
>         Adjacency Matrix (Bijal)
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Bijal,
>
> when constructing your internal graph you must look at the direction of
> edges (and preserve them).
> In the original net the node 10 (or 9 in your notation) has only
> incoming edges, so it cannot be an intermediate node on a valid route.
>
> Greetings, Harald
>
> Am 03.04.19 um 07:42 schrieb Bijal:
> > Dear?Michael,
> > AS per your suggestion,I have written code to get Edge Id from
> > supplied Previous node and NextNode.
> >
> > But in the case where? previous??edge (Say 5) and next edge (Say 3), I
> > am not getting Edge Id. Because i am using?*for edge in x.getOutgoing().*
> > *
> > *
> > *Is there any way to get all the edges attached with node say X?*
> >
> > for x in graph.getNodes():
> > ? ? ? ? if(str(int(x.getID()) - 1) == str(prenode)):
> > ? ? ? ? ? ? print 'Out Going Edge of :' + str(x.getID()) + ' Are ' +
> > str(x.getOutgoing())
> > *? ? ? ? ? ? for edge in x.getOutgoing():*
> > ? ? ? ? ? ? ? ? #print str(int(str(edge.getToNode().getID()))-1) + '
> > == ' + str(nextnode)
> > ? ? ? ? ? ? ? ? #check if Next node of this edge is nextnode??
> > ? ? ? ? ? ? ? ? if(int(str(edge.getToNode().getID()))-1 == nextnode):
> > ? ? ? ? ? ? ? ? ? ? print 'Selected Edge ID is ' + str(edge.getID())
> > ? ? ? ? ? ? ? ? ? ? return str(edge.getID())
> > Output :
> >
> > *trace [0, 6, 9, 7, 8, 3, 2, 1, 5, 4] ----> List of nodes to be
> > selected in the route*
> > *
> > *
> > Out Going Edge of :1 Are [<edge id="1" from="1" to="2"/>, <edge id="2"
> > from="1" to="7"/>]
> > Selected Edge ID is 2
> >
> > Out Going Edge of :7 Are [<edge id="14" from="7" to="8"/>, <edge
> > id="15" from="7" to="10"/>]
> > Selected Edge ID is 15
> >
> > Out Going Edge of :10 Are []
> > *--No Edge identified*
> > Out Going Edge of :8 Are [<edge id="16" from="8" to="9"/>, <edge
> > id="17" from="8" to="10"/>]
> > *Selected Edge ID is 16*
> >
> > Out Going Edge of :9 Are [<edge id="18" from="9" to="10"/>]
> > *--No Edge identified*??
> >
> > Out Going Edge of :4 Are [<edge id="7" from="4" to="5"/>, <edge id="8"
> > from="4" to="9"/>]
> > *--No Edge identified*??
> >
> > Out Going Edge of :3 Are [<edge id="5" from="3" to="5"/>, <edge id="6"
> > from="3" to="4"/>]
> > *--No Edge identified*??
> >
> > Out Going Edge of :2 Are [<edge id="3" from="2" to="3"/>, <edge id="4"
> > from="2" to="6"/>]
> > Selected Edge ID is 4
> >
> > Out Going Edge of :6 Are [<edge id="12" from="6" to="7"/>, <edge
> > id="13" from="6" to="8"/>]
> > *--No Edge identified*
> >
> >
> > On Fri, Mar 29, 2019 at 8:29 PM Bijal <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Dear Sir,
> >
> >     Now adjacency matrix filled fine and ACO ALGORITHM works nicely.
> >
> >     I am getting list of vertexes, Traversed by ant in shortest way :?
> >
> >     Like [0,1,3,4,5,7,8,9,6,2]
> >
> >     Issue : I can get from and to field to build edge using this vertex.
> >
> >     But to create a route I need following :
> >     <Edge Id= from= to=>
> >
> >     Is there anyway to get edge ID to build a route out of this vertex
> >     list?
> >
> >
> >
> >     On Wed 27 Mar, 2019, 5:22 PM , <[email protected]
> >     <mailto:[email protected]>> wrote:
> >
> >         Send sumo-user mailing list submissions to
> >         ? ? ? ? [email protected] <mailto:[email protected]>
> >
> >         To subscribe or unsubscribe via the World Wide Web, visit
> >         ? ? ? ? https://www.eclipse.org/mailman/listinfo/sumo-user
> >         or, via email, send a message with subject or body 'help' to
> >         ? ? ? ? [email protected]
> >         <mailto:[email protected]>
> >
> >         You can reach the person managing the list at
> >         ? ? ? ? [email protected]
> >         <mailto:[email protected]>
> >
> >         When replying, please edit your Subject line so it is more
> >         specific
> >         than "Re: Contents of sumo-user digest..."
> >
> >
> >         Today's Topics:
> >
> >         ? ?1. Re: Traffic Light (iCashWave)
> >         ? ?2. Re: Traffic Light (Jakob Erdmann)
> >         ? ?3. Re: Convert sumolib.net.readnet Graph to Adjacency? ? ?
> >         ? Matrix (Bijal)
> >
> >
> >
>  ----------------------------------------------------------------------
> >
> >         Message: 1
> >         Date: Wed, 27 Mar 2019 18:24:50 +0800
> >         From: iCashWave <[email protected] <mailto:[email protected]
> >>
> >         To: Sumo project User discussions <[email protected]
> >         <mailto:[email protected]>>
> >         Subject: Re: [sumo-user] Traffic Light
> >         Message-ID:
> >         ? ? ? ?
> >         <
> caaujj+u+xcxi9uy_bukw+wg9c_q2w5xoy-rjf7gg+pucjf1...@mail.gmail.com
> >         <mailto:
> caaujj%2bu%2bxcxi9uy_bukw%2bwg9c_q2w5xoy-rjf7gg%[email protected]
> >>
> >         Content-Type: text/plain; charset="utf-8"
> >
> >         Hi,
> >         You should change the light phase,such as chaning G to r.
> >
> >         Cellen Fadi <[email protected]
> >         <mailto:[email protected]>> ? 2019?3?27? ?? 18:04???
> >
> >         > hello,
> >         >
> >         > I would like to change the priority rule at the traffic
> >         lights. Like you
> >         > see on the picture the green and red phases are wrong . I
> >         have tried to
> >         > select conflict in NETEDIT but it does not work. Can you
> >         help me please.
> >         > Thanks!
> >         >
> >         > best regards
> >         > Fadi
> >         > _______________________________________________
> >         > sumo-user mailing list
> >         > [email protected] <mailto:[email protected]>
> >         > To change your delivery options, retrieve your password, or
> >         unsubscribe
> >         > from this list, visit
> >         > https://www.eclipse.org/mailman/listinfo/sumo-user
> >         >
> >         -------------- next part --------------
> >         An HTML attachment was scrubbed...
> >         URL:
> >         <
> https://www.eclipse.org/mailman/private/sumo-user/attachments/20190327/c873add7/attachment.html
> >
> >
> >         ------------------------------
> >
> >         Message: 2
> >         Date: Wed, 27 Mar 2019 12:14:33 +0100
> >         From: Jakob Erdmann <[email protected]
> >         <mailto:[email protected]>>
> >         To: Sumo project User discussions <[email protected]
> >         <mailto:[email protected]>>
> >         Subject: Re: [sumo-user] Traffic Light
> >         Message-ID:
> >         ? ? ? ?
> >         <
> cambucby6kwu0n_ornhdmrv+1s2cdlbhabj4zfx0ej0z7vtv...@mail.gmail.com
> >         <mailto:
> cambucby6kwu0n_ornhdmrv%[email protected]>>
> >         Content-Type: text/plain; charset="utf-8"
> >
> >         You must use the traffic light mode of netedit (hotkey 't') to
> >         edit traffic
> >         light plans.
> >
> >         Am Mi., 27. M?rz 2019 um 11:25 Uhr schrieb iCashWave
> >         <[email protected] <mailto:[email protected]>>:
> >
> >         > Hi,
> >         > You should change the light phase,such as chaning G to r.
> >         >
> >         > Cellen Fadi <[email protected]
> >         <mailto:[email protected]>> ? 2019?3?27? ?? 18:04???
> >         >
> >         >> hello,
> >         >>
> >         >> I would like to change the priority rule at the traffic
> >         lights. Like you
> >         >> see on the picture the green and red phases are wrong . I
> >         have tried to
> >         >> select conflict in NETEDIT but it does not work. Can you
> >         help me please.
> >         >> Thanks!
> >         >>
> >         >> best regards
> >         >> Fadi
> >         >> _______________________________________________
> >         >> sumo-user mailing list
> >         >> [email protected] <mailto:[email protected]>
> >         >> 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
> >         > [email protected] <mailto:[email protected]>
> >         > To change your delivery options, retrieve your password, or
> >         unsubscribe
> >         > from this list, visit
> >         > https://www.eclipse.org/mailman/listinfo/sumo-user
> >         >
> >         -------------- next part --------------
> >         An HTML attachment was scrubbed...
> >         URL:
> >         <
> https://www.eclipse.org/mailman/private/sumo-user/attachments/20190327/65e25d65/attachment.html
> >
> >
> >         ------------------------------
> >
> >         Message: 3
> >         Date: Wed, 27 Mar 2019 17:25:13 +0800
> >         From: Bijal <[email protected]
> >         <mailto:[email protected]>>
> >         To: Sumo project User discussions <[email protected]
> >         <mailto:[email protected]>>
> >         Subject: Re: [sumo-user] Convert sumolib.net.readnet Graph to
> >         ? ? ? ? Adjacency? ? ? ?Matrix
> >         Message-ID:
> >         ? ? ? ?
> >         <
> cabbss+jjh3_upsngvarc6fmic8gwdmve-t4ucwz2rbpzgom...@mail.gmail.com
> >         <mailto:
> cabbss%[email protected]>>
> >         Content-Type: text/plain; charset="utf-8"
> >
> >         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: image.png]
> >
> >
> >         --
> >         *:)*
> >         Bijal Varia
> >         -------------- next part --------------
> >         An HTML attachment was scrubbed...
> >         URL:
> >         <
> https://www.eclipse.org/mailman/private/sumo-user/attachments/20190327/b8ea9bf3/attachment.html
> >
> >         -------------- next part --------------
> >         A non-text attachment was scrubbed...
> >         Name: image.png
> >         Type: image/png
> >         Size: 248841 bytes
> >         Desc: not available
> >         URL:
> >         <
> https://www.eclipse.org/mailman/private/sumo-user/attachments/20190327/b8ea9bf3/attachment.png
> >
> >
> >         ------------------------------
> >
> >         _______________________________________________
> >         sumo-user mailing list
> >         [email protected] <mailto:[email protected]>
> >         To change your delivery options, retrieve your password, or
> >         unsubscribe from this list, visit
> >         https://www.eclipse.org/mailman/listinfo/sumo-user
> >
> >
> >         End of sumo-user Digest, Vol 21, Issue 106
> >         ******************************************
> >
> >
> >
> > --
> > *:)*
> > Bijal Varia
> >
> > _______________________________________________
> > sumo-user mailing list
> > [email protected]
> > To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> > https://www.eclipse.org/mailman/listinfo/sumo-user
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://www.eclipse.org/mailman/private/sumo-user/attachments/20190403/86754e8a/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
>
> End of sumo-user Digest, Vol 22, Issue 9
> ****************************************
>


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

Reply via email to