1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
graph-list Scilab Group Scilab type graph-list
NAME
graph-list - description of graph list
DESCRIPTION
A graph in Scilab is represented by a Scilab typed list. We call it a
graph list. You will find below the complete description of the list.
Each element is described by one or more lines. The first line gives the
name of the element and its definition. Additional informations, such as
the default for elements that can have one, are given in the other lines.
Indeed, only the 5 first elements must have a value in the list, all the
others can be given the empty vector [] as a value, and then the default
is used when it is needed by functions or by the Metanet window. For
instance, you can define a graph list by
g=make_graph('min',1,1,[1],[1]);
which is the simplest graph you can create in Metanet (it is directed,
has one node and one loop arc on this node). The name of the element in
the list is very important because it is used to access the elements of
the list. For instance, if g is a graph list, to get the name of the
graph, you only have to do:
g('name')
and if you want to change the name of the graph to 'toto', you have to
do:
g('name')='toto';
Moreover, you can get the number of edges and the number of arcs of the
graph by using edge_number(g) and arc_number(g) (these names do not
correspond to elements of the list). For compatibility, node_number(g)
can also be used instead of g('node_number'). A graph list can be
syntactically correct but not represent a good graph. You can use the
function check_graph to check it. Moreover it is a good idea to give
nodes different names. In fact, this does not give errors in Scilab, but
strange behaviour can appear when using the Metanet window. This is not
checked by check_graph because it is time consuming. It is only checked
when loading, saving or showing a graph. The elements of a graph list
are given below:
name: - the name of the graph
- it is a string with a maximum of 80 characters
directed:
- flag giving the type of the graph
- it is equal to 1 (graph directed) or equal to 0 (graph
undirected)
node_number:
- number of nodes
tail: - row vector of the tail node numbers
head: - row vector of the head node numbers
node_name:
- row vector of node names
- the names of the nodes must be different
- default is the node numbers as node names
node_type:
- row vector of the node types
- the type is an integer from 0 to 2, default is 0 (plain node):
- 0 = plain node
- 1 = sink node
- 2 = source node
node_x:
- row vector of the x coordinate of the nodes
- default is computed
node_y:
- row vector of the y coordinate of the nodes
- default is computed
node_color:
- row vector of the node colors
- the color is an integer from 0 to 16, default is 0 (default
foreground):
- 0 = default foreground
- 1 = navyblue
- 2 = blue
- 3 = skyblue
- 4 = aquamarine
- 5 = forestgreen
- 6 = green
- 7 = lightcyan
- 8 = cyan
- 9 = orange
- 10 = red
- 11 = magenta
- 12 = violet
- 13 = yellow
- 14 = gold
- 15 = beige
- 16 = background
node_diam:
- row vector of the size of the node diameters in pixels
- a node is drawn as a circle
- default is the value of element default_node_diam
node_border:
- row vector of the size of the node borders in pixels
- a node is drawn as a circle
- default is the value of element default_node_border
node_font_size:
- row vector of the size of the font used to draw the name of the node
- you can choose 8, 10, 12, 14, 18 or 24
- default is the value of element default_font_size
node_demand:
- row vector of the node demands
- default is 0
edge_name:
- row vector of the edge names
- it is better that the names of the edges are different, but
this is not an error
- default is the edge numbers as edge names
edge_color:
- row vector of the edge colors
- the color is an integer from 0 to 16 (see node_color)
- default is 0 (default foreground)
edge_width:
- row vector of the size of the edge widths in pixels
- default is the value of element default_edge_width
edge_hi_width:
- row vector of the size of the highlighted edge widths in pixels
- default is the value of element default_edge_hi_width
edge_font_size:
- row vector of the size of the fonts used to draw the name of the edge
- you can choose 8, 10, 12, 14, 18 or 24
- default is the value of element default_font_size
edge_length:
- row vector of the edge lengths
- default is 0
edge_cost:
- row vector of the edge costs
- default is 0
edge_min_cap:
- row vector of the edge minimum capacities
- default is 0
edge_max_cap:
- row vector of the edge maximum capacities
- default is 0
edge_q_weight:
- row vector of the edge quadratic weights
- default is 0
edge_q_orig:
- row vector of the edge quadratic origins
- default is 0
edge_weight:
- row vector of the edge weights
- default is 0
default_node_diam:
- default size of the node diameters of the graph
- default is 20 pixels
default_node_border:
- default size of the node borders of the graph
- default is 2 pixels
default_edge_width:
- default size of the edge widths of the graph
- default is 1 pixel
default_edge_hi_width:
- default size of the highlighted edge widths of the graph
- default is 3 pixels
default_font_size:
- default size of the font used to draw the names of nodes and edges
- default is 12
node_label:
- row vector of node labels
edge_label:
- row vector of edge labels
EXAMPLE
g=load_graph(SCI+'/demos/metanet/mesh100');
g('node_color')=int(rand(1:g('node_number'))*16);
g('edge_color')=int(rand(1:edge_number(g))*16);
show_graph(g)
SEE ALSO
arc_number, check_graph, edge_number, glist, make_graph, node_number
|