<< split_edge 4_edges_arcs delete_edges >>

metanet >> metanet > 4_edges_arcs > add_edge_data

add_edge_data

associates new data fields to the edges data structure of a graph

Calling Sequence

g = add_edge_data(g,name [,value])

Parameters

g

a graph data structure (see graph_data_structure )

name

a character string, the name of the data field.

value

a row vector or a matrix with column size equal to the number of edges. This parameter is optional. If it is omitted the data field is set to [].

Description

g = add_edge_data(g,name [,value]) associates the data fields named name to the edges data structure of the graph g and assign it the value given by the parameter value. If the last argument is not given the empty matrix [] is assigned.

value can be a matrix of any type. The ith column is associated with theith edge.

Examples

//create a simple graph
ta=[1  1 2 7 8 9 10 10 10 10 11 12 13 13];
he=[2 10 7 8 9 7  7 11 13 13 12 13  9 10];
g=make_graph('simple',1,13,ta,he);
g.nodes.graphics.x=[40,33,29,63,146,233,75,42,114,156,237,260,159];
g.nodes.graphics.y=[7,61,103,142,145,143,43,120,145,18,36,107,107];
show_graph(g,'new')

g=add_edge_data(g,'length',round(10*rand(1,14,'u')));
g=add_edge_data(g,'label','e'+string(1:14));
edgedatafields(g)
g.edges.data.label

See Also


<< split_edge 4_edges_arcs delete_edges >>