.TH v.net.steiner 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBv.net.steiner\fR\fR - Create Steiner tree for the network and given terminals .br Note that 'Minimum Steiner Tree' problem is NP-hard and heuristic algorithm is used in this module so the result may be sub optimal .SH KEYWORDS vector, network, steiner tree .SH SYNOPSIS \fBv.net.steiner\fR .br \fBv.net.steiner help\fR .br \fBv.net.steiner\fR [\-\fBg\fR] \fBinput\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\fBtype\fR=\fIstring\fR[,\fIstring\fR,...]] [\fBalayer\fR=\fIinteger\fR] [\fBnlayer\fR=\fIinteger\fR] [\fBacolumn\fR=\fIstring\fR] \fBtcats\fR=\fIrange\fR [\fBnsp\fR=\fIinteger\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-g\fR" 4m .br Use geodesic calculation for longitude-latitude locations .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br Name of input vector map .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output vector map .IP "\fBtype\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br Arc type .br Options: \fIline,boundary\fR .br Default: \fIline,boundary\fR .IP "\fBalayer\fR=\fIinteger\fR" 4m .br Layer number .br Arc layer .br Default: \fI1\fR .IP "\fBnlayer\fR=\fIinteger\fR" 4m .br Layer number .br Node layer (used for terminals) .br Default: \fI2\fR .IP "\fBacolumn\fR=\fIstring\fR" 4m .br Arcs' cost column (for both directions) .IP "\fBtcats\fR=\fIrange\fR" 4m .br Category values .br Categories of points on terminals (layer is specified by nlayer) .IP "\fBnsp\fR=\fIinteger\fR" 4m .br Number of steiner points (-1 for all possible) .br Default: \fI-1\fR .PP .SH DESCRIPTION \fIv.net.steiner\fR calculates the optimal connection of nodes on a vector network. .PP A Steiner tree is used to calculate the minimum-cost vector network connecting some number of end nodes in a network framework. For example it could be used to find the path following a road system which will minimize the amount of fibre optic cable needed to connect a series of satellite offices. .PP Costs may be either line lengths, or attributes saved in a database table. These attribute values are taken as costs of whole segments, not as costs to traverse a length unit (e.g. meter) of the segment. For example, if the speed limit is 100 km / h, the cost to traverse a 10 km long road segment must be calculated as length / speed = 10 km / (100 km/h) = 0.1 h. Supported are cost assignments for both arcs and nodes. For areas, costs will be calculated along boundary lines. .PP Points representing nodes must be exactly on network nodes, and the input vector map needs to be prepared with \fIv.net operation=connect\fR. .SH EXAMPLE Steiner tree for 6 digitized nodes (Spearfish): .PP Shortest path, along unimproved roads: .PP .PP Fastest path, along highways: .PP \fC .DS .br # Spearfish .br .br g.copy vect=roads,myroads .br .br # we have 6 locations to allocate .br echo "1|601653.5|4922869.2|a .br 2|608284|4923776.6|b .br 3|601845|4914981.9|c .br 4|596270|4917456.3|d .br 5|593330.8|4924096.6|e .br 6|598005.5|4921439.2|f" | v.in.ascii in=- cat=1 x=2 y=3 out=centers col="cat integer, \(rs .br east double precision, north double precision, label varchar(43)" .br .br v.db.select centers .br v.category centers op=report .br # type count min max .br # point 6 1 6 .br .br # create lines map connecting points to network (on layer 2) .br v.net myroads points=centers out=myroads_net op=connect thresh=500 .br .br # set up costs as traveling time .br .br # create unique categories for each road in layer 3 .br v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line .br .br # add new table for layer 3 .br v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision" .br .br # copy road type to layer 3 .br v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label .br .br # upload road length in miles .br v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles .br .br # set speed limits in miles / hour .br v.db.update myroads_net_time layer=3 col=speed val="5.0" .br v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'" .br v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'" .br v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'" .br v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'" .br v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'" .br .br # define traveling costs as traveling time in minutes: .br v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60" .br .br # shortest path .br v.net.steiner myroads_net_time alayer=3 nlayer=2 tcats=1-6 out=mysteiner_distance .br .br # fastest path .br v.net.steiner myroads_net_time alayer=3 nlayer=2 acol=cost tcats=1-6 out=mysteiner_time .br .DE \fR To display the result, run for example: \fC .DS .br # display the results .br g.region vect=myroads_net .br .br # shortest path .br d.mon x0 .br d.vect myroads_net .br d.vect \-c centers icon=basic/triangle .br d.font Vera .br d.vect centers col=red disp=attr attrcol=label lsize=12 .br d.vect mysteiner_distance col=blue width=2 .br .br # fastest path .br d.mon x1 .br d.vect myroads_net .br d.vect \-c centers icon=basic/triangle .br d.font Vera .br d.vect centers col=red disp=attr attrcol=label lsize=12 .br d.vect mysteiner_time col=blue width=2 .br .DE \fR .SH SEE ALSO \fId.path\fR, \fIv.net\fR, \fIv.net.alloc\fR, \fIv.net.iso\fR, \fIv.net.path\fR, \fIv.net.salesman\fR .SH AUTHOR Radim Blazek, ITC-Irst, Trento, Italy .br Documentation: Markus Neteler, Markus Metz .PP \fILast changed: $Date: 2011-11-08 10:42:51 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team