Graphe non connexe

47 views
Skip to first unread message

Damien Philippon

unread,
Nov 15, 2015, 8:26:14 AM11/15/15
to gama-p...@googlegroups.com
Hi everyone,
I have to ask something about graph, and even after looking in the documentation about it, I didn't find any answer. 
Is there any operator which allows the build of a non related graph but which got related components by providing
a shapefile ?

Thanks a lot,
Damien

Benoit Gaudou

unread,
Nov 16, 2015, 7:37:20 AM11/16/15
to gama-p...@googlegroups.com
Hi Damien,
I am wondering: if roads in a shapefile are not all connected, you get a graph with several components. That is what you want right ? 

Benoit 

2015-11-15 14:26 GMT+01:00 Damien Philippon <nijige...@gmail.com>:
Bonjour à tous,
J'ai une question, j'ai cherché dans la doc et rien n'est écrit à ce sujet. 
Y a t'il un opérateur qui permet de concevoir des graphes non connexes mais avec
des composantes connexes en fournissant un shapefile ?

Merci beaucoup,
Damien

--
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 http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Damien Philippon

unread,
Nov 16, 2015, 7:46:43 AM11/16/15
to GAMA
Hi Benoit,
yes this is exactly what i want, but in Gama, it loads only a big connected component and all others aren't loaded. 

Thank you for your answer !
Damien

Benoit Gaudou

unread,
Nov 16, 2015, 7:58:21 AM11/16/15
to gama-p...@googlegroups.com
Hi 
I am surprised ...
I had a lot of problems in my models because the roads were not well connected so, car cannot go from one graph to the other.
I tried with the following shapefile (road classical shapefile), but I cut the graph.
When I import data and create the graph, it seems that all roads are in the graph, even if they are not in the same component : 

model tutorial_gis_city_traffic


global {

file shape_file_roads <- file("../includes/road.shp");

file shape_file_bounds <- file("../includes/bounds.shp");

geometry shape <- envelope(shape_file_bounds);

float step <- 10 #mn;

graph the_graph;

init {

create road from: shape_file_roads ;

the_graph <- as_edge_graph(road);

write the_graph;

}

}



species road  {

rgb color <- #black ;

aspect base {

draw shape color: color ;

}

}


experiment road_traffic type: gui {

parameter "Shapefile for the roads:" var: shape_file_roads category: "GIS" ;

parameter "Shapefile for the bounds:" var: shape_file_bounds category: "GIS" ;

output {

display city_display type:opengl {

species road aspect: base ;

}

}

}

road.dbf
road.shp
road.shx

Damien Philippon

unread,
Nov 16, 2015, 8:17:39 AM11/16/15
to GAMA
Ok, I'm surprised too because it works !
After trying to better understand, it looks like one of the shapefiles of QGIS wasn't refreshed ...
I opened the attributes tables and things were there but not shown in GAMA.. So I created
new shapefiles with the same data, new workspace in GAMA and now it's fine, I don't have
an empty graph. 
In any case, thank you very much !

Damien

HUYNH Nghi

unread,
Nov 16, 2015, 11:03:29 AM11/16/15
to gama-p...@googlegroups.com
Hi Damien,
When i work with Mai, i have counter some problem with graph data  (merge road, cut road, switch form qgis to gama, gama to qgis...). You can found my model which i use to test the number components of a graph (graph connected will have only 1 component). The colors will show that every two the roads are connected (same color) or dispatch (two color).
testGraph.gaml

Damien Philippon

unread,
Nov 17, 2015, 11:37:40 AM11/17/15
to GAMA
Hi Nghi, 
Thank you for your answer, I find your algorithm really interesting and I'll use it to debug my model.
Thank both of you again !
Damien
Reply all
Reply to author
Forward
0 new messages