Find the farthest point on the graph

29 views
Skip to first unread message

Chintan Pathak

unread,
Jan 22, 2019, 10:05:09 PM1/22/19
to GAMA
Dear all,

I want to try to find the point on my road graph, that is farthest from a particular point. This works well once but not the second time. The image attached shows the problem, and the attached code shows some things I have attempted.

I tried to use "first(road_network.vertices)" and "farthest_to", but they both give me answers other than the one expected. I also tried clean_network, but that did not help either.

Any guidance in this regards would be helpful.

Thanks
Chintan Pathak
kauai_FC_illustrated.png
kauai_FC_planning.zip

Kevin Chapuis

unread,
Jan 22, 2019, 10:35:41 PM1/22/19
to gama-p...@googlegroups.com
Dear Chintan Pathak,

This is not clear to me what you trying to achieve. If by "farthest" point from a particular point means the longest shortest path from this point to any other destination on the network, there is a workaround collecting each shortest path starting from this point and picking the longest one. As far as I can tell, the "farthest_to" operator pick the farthest point in the continuous space, not using network topology.

Best,
Kevin

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.


--
Chapuis kevin
Post-Doc / Research Fellow
IRD, UMI 209 UMMISCO
Gen* ANR project

Chintan Pathak

unread,
Jan 23, 2019, 12:08:37 AM1/23/19
to GAMA
Dear Kevin,

Thank you for your response. Your suggested workaround works for me, I am just surprised why farthest_to wouldnt work. It works once in one direction.

For record, I am doing the following:
verts <- road_network.vertices;
loop iii from: 0 to: length(verts) - 1 {
add distance_to(verts[iii], pt_ft_cs[0]) to: distances;
}
ind <- index_of(distances, max(distances));
// ind contains the index of the vertex that is farthest from pt_ft_cs[0]

Thanks

Chintan Pathak

unread,
Jan 23, 2019, 2:27:20 AM1/23/19
to GAMA
Just realized my mistake, the 'farthest_to' statement should be inside 'using topology'. It works fine now.

Thanks


On Tuesday, January 22, 2019 at 7:35:41 PM UTC-8, Kevin Chapuis wrote:
Reply all
Reply to author
Forward
0 new messages